mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Add test for "no trades found" case
This commit is contained in:
parent
483415cd65
commit
72c17e29c0
|
@ -583,6 +583,6 @@ def buy_order_fee():
|
|||
'price': 0.245441,
|
||||
'amount': 8.0,
|
||||
'remaining': 90.99181073,
|
||||
'status': 'open',
|
||||
'status': 'closed',
|
||||
'fee': None
|
||||
}
|
||||
|
|
|
@ -1344,6 +1344,32 @@ def test_get_real_amount_quote(default_conf, trades_for_order, buy_order_fee, ca
|
|||
caplog.record_tuples)
|
||||
|
||||
|
||||
def test_get_real_amount_no_trade(default_conf, buy_order_fee, caplog, mocker):
|
||||
"""
|
||||
Test get_real_amount - fee in quote currency
|
||||
"""
|
||||
|
||||
mocker.patch('freqtrade.exchange.get_trades_for_order', return_value=[])
|
||||
|
||||
patch_get_signal(mocker)
|
||||
patch_RPCManager(mocker)
|
||||
patch_coinmarketcap(mocker)
|
||||
mocker.patch('freqtrade.exchange.validate_pairs', MagicMock(return_value=True))
|
||||
amount = buy_order_fee['amount']
|
||||
trade = Trade(
|
||||
pair='LTC/ETH',
|
||||
amount=amount,
|
||||
exchange='binance',
|
||||
open_rate=0.245441,
|
||||
open_order_id="123456"
|
||||
)
|
||||
freqtrade = FreqtradeBot(default_conf, create_engine('sqlite://'))
|
||||
# Amount is reduced by "fee"
|
||||
assert freqtrade.get_real_amount(trade, buy_order_fee) == amount
|
||||
assert log_has('Applying fee on amount for Trade(id=None, pair=LTC/ETH, amount=8.00000000, '
|
||||
'open_rate=0.24544100, open_since=closed) failed: myTrade-Dict empty found',
|
||||
caplog.record_tuples)
|
||||
|
||||
def test_get_real_amount_stake(default_conf, trades_for_order, buy_order_fee, caplog, mocker):
|
||||
"""
|
||||
Test get_real_amount - fees in Stake currency
|
||||
|
|
Loading…
Reference in New Issue
Block a user