Merge pull request #8184 from LangLazy/feature

Feature market direction
This commit is contained in:
Matthias
2023-02-28 17:22:31 +01:00
committed by GitHub
7 changed files with 109 additions and 9 deletions

View File

@@ -20,7 +20,8 @@ from telegram.error import BadRequest, NetworkError, TelegramError
from freqtrade import __version__
from freqtrade.constants import CANCEL_REASON
from freqtrade.edge import PairInfo
from freqtrade.enums import ExitType, RPCMessageType, RunMode, SignalDirection, State
from freqtrade.enums import (ExitType, MarketDirection, RPCMessageType, RunMode, SignalDirection,
State)
from freqtrade.exceptions import OperationalException
from freqtrade.freqtradebot import FreqtradeBot
from freqtrade.loggers import setup_logging
@@ -106,7 +107,7 @@ def test_telegram_init(default_conf, mocker, caplog) -> None:
"['reload_config', 'reload_conf'], ['show_config', 'show_conf'], "
"['stopbuy', 'stopentry'], ['whitelist'], ['blacklist'], "
"['blacklist_delete', 'bl_delete'], "
"['logs'], ['edge'], ['health'], ['help'], ['version']"
"['logs'], ['edge'], ['health'], ['help'], ['version'], ['marketdir']"
"]")
assert log_has(message_str, caplog)
@@ -2395,3 +2396,15 @@ def test__send_msg_keyboard(default_conf, mocker, caplog) -> None:
assert log_has("using custom keyboard from config.json: "
"[['/daily', '/stats', '/balance', '/profit', '/profit 5'], ['/count', "
"'/start', '/reload_config', '/help']]", caplog)
def test_change_market_direction(default_conf, mocker, update) -> None:
telegram, _, msg_mock = get_telegram_testobject(mocker, default_conf)
assert telegram._rpc._freqtrade.strategy.market_direction == MarketDirection.NONE
context = MagicMock()
context.args = ["long"]
telegram._changemarketdir(update, context)
assert telegram._rpc._freqtrade.strategy.market_direction == MarketDirection.LONG
context = MagicMock()
context.args = ["invalid"]
assert telegram._rpc._freqtrade.strategy.market_direction == MarketDirection.LONG