@@ -29,6 +29,7 @@ def mock_order_1(is_short: bool):
|
||||
'average': 0.123,
|
||||
'amount': 123.0,
|
||||
'filled': 123.0,
|
||||
'cost': 15.129,
|
||||
'remaining': 0.0,
|
||||
}
|
||||
|
||||
@@ -65,6 +66,7 @@ def mock_order_2(is_short: bool):
|
||||
'price': 0.123,
|
||||
'amount': 123.0,
|
||||
'filled': 123.0,
|
||||
'cost': 15.129,
|
||||
'remaining': 0.0,
|
||||
}
|
||||
|
||||
@@ -79,6 +81,7 @@ def mock_order_2_sell(is_short: bool):
|
||||
'price': 0.128,
|
||||
'amount': 123.0,
|
||||
'filled': 123.0,
|
||||
'cost': 15.129,
|
||||
'remaining': 0.0,
|
||||
}
|
||||
|
||||
@@ -126,6 +129,7 @@ def mock_order_3(is_short: bool):
|
||||
'price': 0.05,
|
||||
'amount': 123.0,
|
||||
'filled': 123.0,
|
||||
'cost': 15.129,
|
||||
'remaining': 0.0,
|
||||
}
|
||||
|
||||
@@ -141,6 +145,7 @@ def mock_order_3_sell(is_short: bool):
|
||||
'average': 0.06,
|
||||
'amount': 123.0,
|
||||
'filled': 123.0,
|
||||
'cost': 15.129,
|
||||
'remaining': 0.0,
|
||||
}
|
||||
|
||||
@@ -186,6 +191,7 @@ def mock_order_4(is_short: bool):
|
||||
'price': 0.123,
|
||||
'amount': 123.0,
|
||||
'filled': 0.0,
|
||||
'cost': 15.129,
|
||||
'remaining': 123.0,
|
||||
}
|
||||
|
||||
@@ -225,6 +231,7 @@ def mock_order_5(is_short: bool):
|
||||
'price': 0.123,
|
||||
'amount': 123.0,
|
||||
'filled': 123.0,
|
||||
'cost': 15.129,
|
||||
'remaining': 0.0,
|
||||
}
|
||||
|
||||
@@ -239,6 +246,7 @@ def mock_order_5_stoploss(is_short: bool):
|
||||
'price': 0.123,
|
||||
'amount': 123.0,
|
||||
'filled': 0.0,
|
||||
'cost': 0.0,
|
||||
'remaining': 123.0,
|
||||
}
|
||||
|
||||
@@ -281,6 +289,7 @@ def mock_order_6(is_short: bool):
|
||||
'price': 0.15,
|
||||
'amount': 2.0,
|
||||
'filled': 2.0,
|
||||
'cost': 0.3,
|
||||
'remaining': 0.0,
|
||||
}
|
||||
|
||||
@@ -295,6 +304,7 @@ def mock_order_6_sell(is_short: bool):
|
||||
'price': 0.15 if is_short else 0.20,
|
||||
'amount': 2.0,
|
||||
'filled': 0.0,
|
||||
'cost': 0.0,
|
||||
'remaining': 2.0,
|
||||
}
|
||||
|
||||
@@ -337,6 +347,7 @@ def short_order():
|
||||
'price': 0.123,
|
||||
'amount': 123.0,
|
||||
'filled': 123.0,
|
||||
'cost': 15.129,
|
||||
'remaining': 0.0,
|
||||
}
|
||||
|
||||
@@ -351,6 +362,7 @@ def exit_short_order():
|
||||
'price': 0.128,
|
||||
'amount': 123.0,
|
||||
'filled': 123.0,
|
||||
'cost': 15.744,
|
||||
'remaining': 0.0,
|
||||
}
|
||||
|
||||
@@ -424,6 +436,7 @@ def leverage_order():
|
||||
'amount': 123.0,
|
||||
'filled': 123.0,
|
||||
'remaining': 0.0,
|
||||
'cost': 15.129,
|
||||
'leverage': 5.0
|
||||
}
|
||||
|
||||
@@ -439,6 +452,7 @@ def leverage_order_sell():
|
||||
'amount': 123.0,
|
||||
'filled': 123.0,
|
||||
'remaining': 0.0,
|
||||
'cost': 15.744,
|
||||
'leverage': 5.0
|
||||
}
|
||||
|
||||
|
@@ -724,7 +724,9 @@ def test_api_edge_disabled(botclient, mocker, ticker, fee, markets):
|
||||
'profit_closed_fiat': -83.19455985, 'profit_closed_ratio_mean': -0.0075,
|
||||
'profit_closed_percent_mean': -0.75, 'profit_closed_ratio_sum': -0.015,
|
||||
'profit_closed_percent_sum': -1.5, 'profit_closed_ratio': -6.739057628404269e-06,
|
||||
'profit_closed_percent': -0.0, 'winning_trades': 0, 'losing_trades': 2}
|
||||
'profit_closed_percent': -0.0, 'winning_trades': 0, 'losing_trades': 2,
|
||||
'profit_factor': 0.0, 'trading_volume': 91.074,
|
||||
}
|
||||
),
|
||||
(
|
||||
False,
|
||||
@@ -737,7 +739,9 @@ def test_api_edge_disabled(botclient, mocker, ticker, fee, markets):
|
||||
'profit_closed_fiat': 9.124559849999999, 'profit_closed_ratio_mean': 0.0075,
|
||||
'profit_closed_percent_mean': 0.75, 'profit_closed_ratio_sum': 0.015,
|
||||
'profit_closed_percent_sum': 1.5, 'profit_closed_ratio': 7.391275897987988e-07,
|
||||
'profit_closed_percent': 0.0, 'winning_trades': 2, 'losing_trades': 0}
|
||||
'profit_closed_percent': 0.0, 'winning_trades': 2, 'losing_trades': 0,
|
||||
'profit_factor': None, 'trading_volume': 91.074,
|
||||
}
|
||||
),
|
||||
(
|
||||
None,
|
||||
@@ -750,7 +754,9 @@ def test_api_edge_disabled(botclient, mocker, ticker, fee, markets):
|
||||
'profit_closed_fiat': -67.02260985, 'profit_closed_ratio_mean': 0.0025,
|
||||
'profit_closed_percent_mean': 0.25, 'profit_closed_ratio_sum': 0.005,
|
||||
'profit_closed_percent_sum': 0.5, 'profit_closed_ratio': -5.429078808526421e-06,
|
||||
'profit_closed_percent': -0.0, 'winning_trades': 1, 'losing_trades': 1}
|
||||
'profit_closed_percent': -0.0, 'winning_trades': 1, 'losing_trades': 1,
|
||||
'profit_factor': 0.02775724835771106, 'trading_volume': 91.074,
|
||||
}
|
||||
)
|
||||
])
|
||||
def test_api_profit(botclient, mocker, ticker, fee, markets, is_short, expected):
|
||||
@@ -803,6 +809,10 @@ def test_api_profit(botclient, mocker, ticker, fee, markets, is_short, expected)
|
||||
'closed_trade_count': 2,
|
||||
'winning_trades': expected['winning_trades'],
|
||||
'losing_trades': expected['losing_trades'],
|
||||
'profit_factor': expected['profit_factor'],
|
||||
'max_drawdown': ANY,
|
||||
'max_drawdown_abs': ANY,
|
||||
'trading_volume': expected['trading_volume'],
|
||||
}
|
||||
|
||||
|
||||
|
@@ -704,11 +704,13 @@ def test_profit_handle(default_conf_usdt, update, ticker_usdt, ticker_sell_up, f
|
||||
assert '∙ `6.253 USD`' in msg_mock.call_args_list[-1][0][0]
|
||||
|
||||
assert '*Best Performing:* `ETH/USDT: 9.45%`' in msg_mock.call_args_list[-1][0][0]
|
||||
assert '*Max Drawdown:*' in msg_mock.call_args_list[-1][0][0]
|
||||
assert '*Profit factor:*' in msg_mock.call_args_list[-1][0][0]
|
||||
assert '*Trading volume:* `60 USDT`' in msg_mock.call_args_list[-1][0][0]
|
||||
|
||||
|
||||
@pytest.mark.parametrize('is_short', [True, False])
|
||||
def test_telegram_stats(default_conf, update, ticker, ticker_sell_up, fee,
|
||||
limit_buy_order, limit_sell_order, mocker, is_short) -> None:
|
||||
def test_telegram_stats(default_conf, update, ticker, fee, mocker, is_short) -> None:
|
||||
mocker.patch('freqtrade.rpc.rpc.CryptoToFiatConverter._find_price', return_value=15000.0)
|
||||
mocker.patch.multiple(
|
||||
'freqtrade.exchange.Exchange',
|
||||
|
@@ -2269,6 +2269,7 @@ def test_Trade_object_idem():
|
||||
'get_exit_reason_performance',
|
||||
'get_enter_tag_performance',
|
||||
'get_mix_tag_performance',
|
||||
'get_trading_volume',
|
||||
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user