Don't "fix" dry-run kucoin orders

closes #8229
This commit is contained in:
Matthias 2023-02-26 16:11:47 +01:00
parent 6f7ab97fc3
commit 5b0bc5bbc5
2 changed files with 9 additions and 7 deletions

View File

@ -64,6 +64,7 @@ class Kucoin(Exchange):
# ccxt returns status = 'closed' at the moment - which is information ccxt invented. # ccxt returns status = 'closed' at the moment - which is information ccxt invented.
# Since we rely on status heavily, we must set it to 'open' here. # Since we rely on status heavily, we must set it to 'open' here.
# ref: https://github.com/ccxt/ccxt/pull/16674, (https://github.com/ccxt/ccxt/pull/16553) # ref: https://github.com/ccxt/ccxt/pull/16674, (https://github.com/ccxt/ccxt/pull/16553)
res['type'] = ordertype if not self._config['dry_run']:
res['status'] = 'open' res['type'] = ordertype
res['status'] = 'open'
return res return res

View File

@ -27,7 +27,7 @@ from tests.conftest import (generate_test_data_raw, get_mock_coro, get_patched_e
# Make sure to always keep one exchange here which is NOT subclassed!! # Make sure to always keep one exchange here which is NOT subclassed!!
EXCHANGES = ['bittrex', 'binance', 'kraken', 'gate', 'bybit'] EXCHANGES = ['bittrex', 'binance', 'kraken', 'gate', 'kucoin', 'bybit']
get_entry_rate_data = [ get_entry_rate_data = [
('other', 20, 19, 10, 0.0, 20), # Full ask side ('other', 20, 19, 10, 0.0, 20), # Full ask side
@ -1269,7 +1269,7 @@ def test_create_dry_run_order_limit_fill(default_conf, mocker, side, price, fill
fetch_l2_order_book=order_book_l2_usd, fetch_l2_order_book=order_book_l2_usd,
) )
order = exchange.create_dry_run_order( order = exchange.create_order(
pair='LTC/USDT', pair='LTC/USDT',
ordertype='limit', ordertype='limit',
side=side, side=side,
@ -1332,7 +1332,7 @@ def test_create_dry_run_order_market_fill(default_conf, mocker, side, rate, amou
fetch_l2_order_book=order_book_l2_usd, fetch_l2_order_book=order_book_l2_usd,
) )
order = exchange.create_dry_run_order( order = exchange.create_order(
pair='LTC/USDT', pair='LTC/USDT',
ordertype='market', ordertype='market',
side=side, side=side,
@ -1425,9 +1425,10 @@ def test_create_order(default_conf, mocker, side, ordertype, rate, marketprice,
assert order['amount'] == 0.01 assert order['amount'] == 0.01
def test_buy_dry_run(default_conf, mocker): @pytest.mark.parametrize("exchange_name", EXCHANGES)
def test_buy_dry_run(default_conf, mocker, exchange_name):
default_conf['dry_run'] = True default_conf['dry_run'] = True
exchange = get_patched_exchange(mocker, default_conf) exchange = get_patched_exchange(mocker, default_conf, id=exchange_name)
order = exchange.create_order(pair='ETH/BTC', ordertype='limit', side="buy", order = exchange.create_order(pair='ETH/BTC', ordertype='limit', side="buy",
amount=1, rate=200, leverage=1.0, amount=1, rate=200, leverage=1.0,