changed test_update_trade_state_withorderdict to usdt
This commit is contained in:
parent
8d7f75c4de
commit
d1e3d48075
@ -1598,27 +1598,34 @@ def result(testdatadir):
|
|||||||
|
|
||||||
@pytest.fixture(scope="function")
|
@pytest.fixture(scope="function")
|
||||||
def trades_for_order():
|
def trades_for_order():
|
||||||
return [{'info': {'id': 34567,
|
return [{
|
||||||
'orderId': 123456,
|
'info': {
|
||||||
'price': '0.24544100',
|
'id': 34567,
|
||||||
'qty': '8.00000000',
|
'orderId': 123456,
|
||||||
'commission': '0.00800000',
|
'price': '0.24544100',
|
||||||
'commissionAsset': 'LTC',
|
'qty': '8.00000000',
|
||||||
'time': 1521663363189,
|
'commission': '0.00800000',
|
||||||
'isBuyer': True,
|
'commissionAsset': 'LTC',
|
||||||
'isMaker': False,
|
'time': 1521663363189,
|
||||||
'isBestMatch': True},
|
'isBuyer': True,
|
||||||
'timestamp': 1521663363189,
|
'isMaker': False,
|
||||||
'datetime': '2018-03-21T20:16:03.189Z',
|
'isBestMatch': True
|
||||||
'symbol': 'LTC/ETH',
|
},
|
||||||
'id': '34567',
|
'timestamp': 1521663363189,
|
||||||
'order': '123456',
|
'datetime': '2018-03-21T20:16:03.189Z',
|
||||||
'type': None,
|
'symbol': 'LTC/USDT',
|
||||||
'side': 'buy',
|
'id': '34567',
|
||||||
'price': 0.245441,
|
'order': '123456',
|
||||||
'cost': 1.963528,
|
'type': None,
|
||||||
'amount': 8.0,
|
'side': 'buy',
|
||||||
'fee': {'cost': 0.008, 'currency': 'LTC'}}]
|
'price': 2.0,
|
||||||
|
'cost': 16.0,
|
||||||
|
'amount': 8.0,
|
||||||
|
'fee': {
|
||||||
|
'cost': 0.008,
|
||||||
|
'currency': 'LTC'
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="function")
|
@pytest.fixture(scope="function")
|
||||||
|
@ -1207,6 +1207,7 @@ def test_handle_stoploss_on_exchange_trailing(mocker, default_conf, fee,
|
|||||||
patch_get_signal(freqtrade)
|
patch_get_signal(freqtrade)
|
||||||
|
|
||||||
freqtrade.enter_positions()
|
freqtrade.enter_positions()
|
||||||
|
# TODO-lev: Get this trade switched to the usdt trades
|
||||||
trade = Trade.query.first()
|
trade = Trade.query.first()
|
||||||
trade.is_open = True
|
trade.is_open = True
|
||||||
trade.open_order_id = None
|
trade.open_order_id = None
|
||||||
@ -1709,17 +1710,20 @@ def test_update_trade_state_withorderdict(default_conf, trades_for_order, limit_
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
amount = sum(x['amount'] for x in trades_for_order)
|
amount = sum(x['amount'] for x in trades_for_order)
|
||||||
freqtrade = get_patched_freqtradebot(mocker, default_conf)
|
freqtrade = get_patched_freqtradebot(mocker, default_conf)
|
||||||
|
caplog.clear()
|
||||||
trade = Trade(
|
trade = Trade(
|
||||||
pair='LTC/ETH',
|
pair='LTC/USDT',
|
||||||
amount=amount,
|
amount=amount,
|
||||||
exchange='binance',
|
exchange='binance',
|
||||||
open_rate=0.245441,
|
open_rate=2.0,
|
||||||
open_date=arrow.utcnow().datetime,
|
open_date=arrow.utcnow().datetime,
|
||||||
fee_open=fee.return_value,
|
fee_open=fee.return_value,
|
||||||
fee_close=fee.return_value,
|
fee_close=fee.return_value,
|
||||||
open_order_id="123456",
|
open_order_id="123456",
|
||||||
is_open=True,
|
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)
|
freqtrade.update_trade_state(trade, '123456', limit_buy_order_usdt)
|
||||||
assert trade.amount != amount
|
assert trade.amount != amount
|
||||||
assert trade.amount == limit_buy_order_usdt['amount']
|
assert trade.amount == limit_buy_order_usdt['amount']
|
||||||
|
Loading…
Reference in New Issue
Block a user