added new text

This commit is contained in:
Rahul
2023-02-17 22:01:00 +00:00
parent 1a74ede126
commit 72af1912ca
5 changed files with 28 additions and 23 deletions

View File

@@ -5,6 +5,7 @@ from freqtrade.enums.exitchecktuple import ExitCheckTuple
from freqtrade.enums.exittype import ExitType
from freqtrade.enums.hyperoptstate import HyperoptState
from freqtrade.enums.marginmode import MarginMode
from freqtrade.enums.marketstatetype import MarketDirection
from freqtrade.enums.ordertypevalue import OrderTypeValues
from freqtrade.enums.pricetype import PriceType
from freqtrade.enums.rpcmessagetype import NO_ECHO_MESSAGES, RPCMessageType, RPCRequestType
@@ -12,4 +13,3 @@ from freqtrade.enums.runmode import NON_UTIL_MODES, OPTIMIZE_MODES, TRADING_MODE
from freqtrade.enums.signaltype import SignalDirection, SignalTagType, SignalType
from freqtrade.enums.state import State
from freqtrade.enums.tradingmode import TradingMode
from freqtrade.enums.marketstatetype import MarketDirection

View File

@@ -9,18 +9,3 @@ class MarketDirection(Enum):
SHORT = "short"
EVEN = "even"
NONE = ''
@staticmethod
def string_to_enum(label : str) -> str:
match label:
case "long":
return MarketDirection.LONG
case "short":
return MarketDirection.SHORT
case "even":
return MarketDirection.EVEN
case 'none':
return MarketDirection.NONE
case _:
return None

View File

@@ -1689,7 +1689,15 @@ class Telegram(RPCHandler):
:return: None
"""
if context.args and len(context.args) == 1:
market_dir = MarketDirection.string_to_enum(context.args[0])
if market_dir:
self._rpc._freqtrade.strategy.market_direction = market_dir
new_market_dir = context.args[0]
match new_market_dir:
case "long":
self._rpc._freqtrade.strategy.market_direction = MarketDirection.LONG
case "short":
self._rpc._freqtrade.strategy.market_direction = MarketDirection.SHORT
case "even":
self._rpc._freqtrade.strategy.market_direction = MarketDirection.EVEN
case "none":
self._rpc._freqtrade.strategy.market_direction = MarketDirection.NONE
case _:
raise RPCException("Invalid market direction provided")

View File

@@ -12,8 +12,8 @@ from pandas import DataFrame
from freqtrade.constants import Config, IntOrInf, ListPairsWithTimeframes
from freqtrade.data.dataprovider import DataProvider
from freqtrade.enums import (CandleType, ExitCheckTuple, ExitType, MarketDirection, RunMode, SignalDirection,
SignalTagType, SignalType, TradingMode)
from freqtrade.enums import (CandleType, ExitCheckTuple, ExitType, MarketDirection, RunMode,
SignalDirection, SignalTagType, SignalType, TradingMode)
from freqtrade.exceptions import OperationalException, StrategyError
from freqtrade.exchange import timeframe_to_minutes, timeframe_to_next_date, timeframe_to_seconds
from freqtrade.misc import remove_entry_exit_signals