test_create_dry_run_order_fees
This commit is contained in:
parent
5d9aee6b7e
commit
dac9931b4a
@ -1125,6 +1125,47 @@ def test_create_dry_run_order(default_conf, mocker, side, exchange_name, leverag
|
||||
assert order["cost"] == 1 * 200 / leverage
|
||||
|
||||
|
||||
@pytest.mark.parametrize('side,is_short,order_reason', [
|
||||
("buy", False, "entry"),
|
||||
("sell", False, "exit"),
|
||||
("buy", True, "exit"),
|
||||
("sell", True, "entry"),
|
||||
])
|
||||
@pytest.mark.parametrize("order_type,price_side,fee", [
|
||||
("limit", "same", 1.0),
|
||||
("limit", "other", 2.0),
|
||||
("market", "same", 2.0),
|
||||
("market", "other", 2.0),
|
||||
])
|
||||
def test_create_dry_run_order_fees(
|
||||
default_conf,
|
||||
mocker,
|
||||
side,
|
||||
order_type,
|
||||
is_short,
|
||||
order_reason,
|
||||
price_side,
|
||||
fee,
|
||||
):
|
||||
default_conf[f"{order_reason}_pricing"]["price_side"] = "same"
|
||||
default_conf["order_types"][order_reason] = order_type
|
||||
mocker.patch(
|
||||
'freqtrade.exchange.Exchange.get_fee',
|
||||
lambda symbol, taker_or_maker: 2.0 if taker_or_maker == 'taker' else 1.0
|
||||
)
|
||||
exchange = get_patched_exchange(mocker, default_conf)
|
||||
|
||||
order = exchange.create_dry_run_order(
|
||||
pair='ADA/USDT',
|
||||
ordertype=order_type,
|
||||
side=side,
|
||||
amount=10,
|
||||
rate=2.0,
|
||||
)
|
||||
|
||||
assert order['ft_fee_base'] == fee
|
||||
|
||||
|
||||
@pytest.mark.parametrize("side,startprice,endprice", [
|
||||
("buy", 25.563, 25.566),
|
||||
("sell", 25.566, 25.563)
|
||||
|
Loading…
Reference in New Issue
Block a user