Update ccxt compat tests with kucoin order

This commit is contained in:
Matthias 2023-01-29 19:56:13 +01:00
parent fee7b792e1
commit ede79590da

View File

@ -43,7 +43,7 @@ EXCHANGES = {
'hasQuoteVolumeFutures': True, 'hasQuoteVolumeFutures': True,
'leverage_tiers_public': False, 'leverage_tiers_public': False,
'leverage_in_spot_market': False, 'leverage_in_spot_market': False,
'sample_order': { 'sample_order': [{
"symbol": "SOLUSDT", "symbol": "SOLUSDT",
"orderId": 3551312894, "orderId": 3551312894,
"orderListId": -1, "orderListId": -1,
@ -60,7 +60,7 @@ EXCHANGES = {
"workingTime": 1674493798550, "workingTime": 1674493798550,
"fills": [], "fills": [],
"selfTradePreventionMode": "NONE", "selfTradePreventionMode": "NONE",
} }]
}, },
'binanceus': { 'binanceus': {
'pair': 'BTC/USDT', 'pair': 'BTC/USDT',
@ -68,7 +68,7 @@ EXCHANGES = {
'hasQuoteVolume': True, 'hasQuoteVolume': True,
'timeframe': '5m', 'timeframe': '5m',
'futures': False, 'futures': False,
'sample_order': { 'sample_order': [{
"symbol": "SOLUSDT", "symbol": "SOLUSDT",
"orderId": 3551312894, "orderId": 3551312894,
"orderListId": -1, "orderListId": -1,
@ -85,7 +85,7 @@ EXCHANGES = {
"workingTime": 1674493798550, "workingTime": 1674493798550,
"fills": [], "fills": [],
"selfTradePreventionMode": "NONE", "selfTradePreventionMode": "NONE",
} }]
}, },
'kraken': { 'kraken': {
'pair': 'BTC/USDT', 'pair': 'BTC/USDT',
@ -102,6 +102,40 @@ EXCHANGES = {
'timeframe': '5m', 'timeframe': '5m',
'leverage_tiers_public': False, 'leverage_tiers_public': False,
'leverage_in_spot_market': True, 'leverage_in_spot_market': True,
'sample_order': [
{'id': '63d6742d0adc5570001d2bbf7'}, # create order
{
'id': '63d6742d0adc5570001d2bbf7',
'symbol': 'NAKA-USDT',
'opType': 'DEAL',
'type': 'limit',
'side': 'buy',
'price': '30',
'size': '0.1',
'funds': '0',
'dealFunds': '0.032626',
'dealSize': '0.1',
'fee': '0.000065252',
'feeCurrency': 'USDT',
'stp': '',
'stop': '',
'stopTriggered': False,
'stopPrice': '0',
'timeInForce': 'GTC',
'postOnly': False,
'hidden': False,
'iceberg': False,
'visibleSize': '0',
'cancelAfter': 0,
'channel': 'API',
'clientOid': '0a053870-11bf-41e5-be61-b272a4cb62e1',
'remark': None,
'tags': 'partner:ccxt',
'isActive': False,
'cancelExist': False,
'createdAt': 1674493798550,
'tradeType': 'TRADE'
}],
}, },
'gateio': { 'gateio': {
'pair': 'BTC/USDT', 'pair': 'BTC/USDT',
@ -256,10 +290,14 @@ class TestCCXTExchange():
def test_ccxt_order_parse(self, exchange: EXCHANGE_FIXTURE_TYPE): def test_ccxt_order_parse(self, exchange: EXCHANGE_FIXTURE_TYPE):
exch, exchange_name = exchange exch, exchange_name = exchange
if stuff := EXCHANGES[exchange_name].get('sample_order'): if orders := EXCHANGES[exchange_name].get('sample_order'):
for order in orders:
po = exch._api.parse_order(stuff) po = exch._api.parse_order(order)
assert isinstance(po['id'], str)
assert po['id'] is not None
if len(order.keys()) > 1:
assert po['timestamp'] == 1674493798550 assert po['timestamp'] == 1674493798550
assert isinstance(po['datetime'], str)
assert isinstance(po['timestamp'], int) assert isinstance(po['timestamp'], int)
assert isinstance(po['price'], float) assert isinstance(po['price'], float)
assert isinstance(po['amount'], float) assert isinstance(po['amount'], float)