Fix fee handling for futures trades
This commit is contained in:
@@ -4165,7 +4165,10 @@ def test__order_contracts_to_amount(
|
||||
'cost': 60.0,
|
||||
'filled': None,
|
||||
'remaining': 30.0,
|
||||
'fee': 0.06,
|
||||
'fee': {
|
||||
'currency': 'USDT',
|
||||
'cost': 0.06,
|
||||
},
|
||||
'fees': [{
|
||||
'currency': 'USDT',
|
||||
'cost': 0.06,
|
||||
@@ -4192,7 +4195,10 @@ def test__order_contracts_to_amount(
|
||||
'cost': 80.0,
|
||||
'filled': None,
|
||||
'remaining': 40.0,
|
||||
'fee': 0.08,
|
||||
'fee': {
|
||||
'currency': 'USDT',
|
||||
'cost': 0.08,
|
||||
},
|
||||
'fees': [{
|
||||
'currency': 'USDT',
|
||||
'cost': 0.08,
|
||||
@@ -4226,12 +4232,18 @@ def test__order_contracts_to_amount(
|
||||
'info': {},
|
||||
},
|
||||
]
|
||||
order1_bef = orders[0]
|
||||
order2_bef = orders[1]
|
||||
order1 = exchange._order_contracts_to_amount(deepcopy(order1_bef))
|
||||
order2 = exchange._order_contracts_to_amount(deepcopy(order2_bef))
|
||||
assert order1['amount'] == order1_bef['amount'] * contract_size
|
||||
assert order1['cost'] == order1_bef['cost'] * contract_size
|
||||
|
||||
order1 = exchange._order_contracts_to_amount(orders[0])
|
||||
order2 = exchange._order_contracts_to_amount(orders[1])
|
||||
assert order2['amount'] == order2_bef['amount'] * contract_size
|
||||
assert order2['cost'] == order2_bef['cost'] * contract_size
|
||||
|
||||
# Don't fail
|
||||
exchange._order_contracts_to_amount(orders[2])
|
||||
assert order1['amount'] == 30.0 * contract_size
|
||||
assert order2['amount'] == 40.0 * contract_size
|
||||
|
||||
|
||||
@pytest.mark.parametrize('pair,contract_size,trading_mode', [
|
||||
|
Reference in New Issue
Block a user