Add workaround patch for kucoin create_order returning empty

While the actual problem is caused by a ccxt change, the change itself makes sense.
once ccxt starts returning the correct status (open) for create-orders, we can remove the fix.

closes #8079
This commit is contained in:
Matthias 2023-01-31 20:42:41 +01:00
parent 448505fbfb
commit 680136f57d

View File

@ -36,3 +36,34 @@ class Kucoin(Exchange):
'stop': 'loss' 'stop': 'loss'
}) })
return params return params
def create_order(
self,
*,
pair: str,
ordertype: str,
side: BuySell,
amount: float,
rate: float,
leverage: float,
reduceOnly: bool = False,
time_in_force: str = 'GTC',
) -> Dict:
res = super().create_order(
pair=pair,
ordertype=ordertype,
side=side,
amount=amount,
rate=rate,
leverage=leverage,
reduceOnly=reduceOnly,
time_in_force=time_in_force,
)
# Kucoin returns only the order-id.
# 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.
# ref: https://github.com/ccxt/ccxt/pull/16674, (https://github.com/ccxt/ccxt/pull/16553)
res['type'] = ordertype
res['status'] = 'open'
return res