changed test_update_trade_state_withorderdict to usdt

This commit is contained in:
Sam Germain 2021-09-26 02:43:47 -06:00
parent 8d7f75c4de
commit d1e3d48075
2 changed files with 34 additions and 23 deletions

View File

@ -1598,7 +1598,9 @@ def result(testdatadir):
@pytest.fixture(scope="function")
def trades_for_order():
return [{'info': {'id': 34567,
return [{
'info': {
'id': 34567,
'orderId': 123456,
'price': '0.24544100',
'qty': '8.00000000',
@ -1607,18 +1609,23 @@ def trades_for_order():
'time': 1521663363189,
'isBuyer': True,
'isMaker': False,
'isBestMatch': True},
'isBestMatch': True
},
'timestamp': 1521663363189,
'datetime': '2018-03-21T20:16:03.189Z',
'symbol': 'LTC/ETH',
'symbol': 'LTC/USDT',
'id': '34567',
'order': '123456',
'type': None,
'side': 'buy',
'price': 0.245441,
'cost': 1.963528,
'price': 2.0,
'cost': 16.0,
'amount': 8.0,
'fee': {'cost': 0.008, 'currency': 'LTC'}}]
'fee': {
'cost': 0.008,
'currency': 'LTC'
}
}]
@pytest.fixture(scope="function")

View File

@ -1207,6 +1207,7 @@ def test_handle_stoploss_on_exchange_trailing(mocker, default_conf, fee,
patch_get_signal(freqtrade)
freqtrade.enter_positions()
# TODO-lev: Get this trade switched to the usdt trades
trade = Trade.query.first()
trade.is_open = True
trade.open_order_id = None
@ -1709,17 +1710,20 @@ def test_update_trade_state_withorderdict(default_conf, trades_for_order, limit_
patch_exchange(mocker)
amount = sum(x['amount'] for x in trades_for_order)
freqtrade = get_patched_freqtradebot(mocker, default_conf)
caplog.clear()
trade = Trade(
pair='LTC/ETH',
pair='LTC/USDT',
amount=amount,
exchange='binance',
open_rate=0.245441,
open_rate=2.0,
open_date=arrow.utcnow().datetime,
fee_open=fee.return_value,
fee_close=fee.return_value,
open_order_id="123456",
is_open=True,
)
# TODO-lev: caplog.text has Amount 60.00000000000001 does not match amount 60.00000000000001
# TODO-lev: but they are the exact same
freqtrade.update_trade_state(trade, '123456', limit_buy_order_usdt)
assert trade.amount != amount
assert trade.amount == limit_buy_order_usdt['amount']