ccxt 4.4.4__py2.py3-none-any.whl → 4.4.6__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ccxt/__init__.py +1 -1
- ccxt/abstract/binanceus.py +36 -36
- ccxt/abstract/bitmart.py +4 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +3 -3
- ccxt/async_support/binanceus.py +1 -0
- ccxt/async_support/bitflyer.py +2 -2
- ccxt/async_support/bitget.py +50 -91
- ccxt/async_support/bitmart.py +179 -127
- ccxt/async_support/bybit.py +88 -7
- ccxt/async_support/coinbase.py +6 -8
- ccxt/async_support/kraken.py +5 -1
- ccxt/async_support/lykke.py +2 -2
- ccxt/async_support/mexc.py +36 -7
- ccxt/async_support/paradex.py +1 -1
- ccxt/base/exchange.py +1 -1
- ccxt/binance.py +3 -3
- ccxt/binanceus.py +1 -0
- ccxt/bitflyer.py +2 -2
- ccxt/bitget.py +50 -91
- ccxt/bitmart.py +179 -127
- ccxt/bybit.py +88 -7
- ccxt/coinbase.py +6 -8
- ccxt/kraken.py +5 -1
- ccxt/lykke.py +2 -2
- ccxt/mexc.py +36 -7
- ccxt/paradex.py +1 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +6 -2
- ccxt/pro/binanceus.py +2 -1
- ccxt/pro/htx.py +14 -0
- ccxt/pro/hyperliquid.py +14 -1
- ccxt/pro/kraken.py +57 -0
- ccxt/pro/paradex.py +1 -0
- {ccxt-4.4.4.dist-info → ccxt-4.4.6.dist-info}/METADATA +4 -4
- {ccxt-4.4.4.dist-info → ccxt-4.4.6.dist-info}/RECORD +40 -40
- {ccxt-4.4.4.dist-info → ccxt-4.4.6.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.4.dist-info → ccxt-4.4.6.dist-info}/WHEEL +0 -0
- {ccxt-4.4.4.dist-info → ccxt-4.4.6.dist-info}/top_level.txt +0 -0
ccxt/bitmart.py
CHANGED
@@ -268,6 +268,10 @@ class bitmart(Exchange, ImplicitAPI):
|
|
268
268
|
'contract/private/submit-plan-order': 2.5,
|
269
269
|
'contract/private/cancel-plan-order': 1.5,
|
270
270
|
'contract/private/submit-leverage': 2.5,
|
271
|
+
'contract/private/submit-tp-sl-order': 2.5,
|
272
|
+
'contract/private/modify-plan-order': 2.5,
|
273
|
+
'contract/private/modify-preset-plan-order': 2.5,
|
274
|
+
'contract/private/modify-tp-sl-order': 2.5,
|
271
275
|
},
|
272
276
|
},
|
273
277
|
},
|
@@ -881,43 +885,43 @@ class bitmart(Exchange, ImplicitAPI):
|
|
881
885
|
def fetch_contract_markets(self, params={}):
|
882
886
|
response = self.publicGetContractPublicDetails(params)
|
883
887
|
#
|
884
|
-
#
|
885
|
-
#
|
886
|
-
#
|
887
|
-
#
|
888
|
-
#
|
889
|
-
#
|
890
|
-
#
|
891
|
-
#
|
892
|
-
#
|
893
|
-
#
|
894
|
-
#
|
895
|
-
#
|
896
|
-
#
|
897
|
-
#
|
898
|
-
#
|
899
|
-
#
|
900
|
-
#
|
901
|
-
#
|
902
|
-
#
|
903
|
-
#
|
904
|
-
#
|
905
|
-
#
|
906
|
-
#
|
907
|
-
#
|
908
|
-
#
|
909
|
-
#
|
910
|
-
#
|
911
|
-
#
|
912
|
-
#
|
913
|
-
#
|
914
|
-
#
|
915
|
-
#
|
916
|
-
#
|
917
|
-
#
|
918
|
-
#
|
888
|
+
# {
|
889
|
+
# "code": 1000,
|
890
|
+
# "message": "Ok",
|
891
|
+
# "data": {
|
892
|
+
# "symbols": [
|
893
|
+
# {
|
894
|
+
# "symbol": "BTCUSDT",
|
895
|
+
# "product_type": 1,
|
896
|
+
# "open_timestamp": 1645977600000,
|
897
|
+
# "expire_timestamp": 0,
|
898
|
+
# "settle_timestamp": 0,
|
899
|
+
# "base_currency": "BTC",
|
900
|
+
# "quote_currency": "USDT",
|
901
|
+
# "last_price": "63547.4",
|
902
|
+
# "volume_24h": "110938430",
|
903
|
+
# "turnover_24h": "7004836342.6944",
|
904
|
+
# "index_price": "63587.85404255",
|
905
|
+
# "index_name": "BTCUSDT",
|
906
|
+
# "contract_size": "0.001",
|
907
|
+
# "min_leverage": "1",
|
908
|
+
# "max_leverage": "100",
|
909
|
+
# "price_precision": "0.1",
|
910
|
+
# "vol_precision": "1",
|
911
|
+
# "max_volume": "1000000",
|
912
|
+
# "min_volume": "1",
|
913
|
+
# "funding_rate": "0.0000801",
|
914
|
+
# "expected_funding_rate": "-0.0000035",
|
915
|
+
# "open_interest": "278214",
|
916
|
+
# "open_interest_value": "17555316.9355496",
|
917
|
+
# "high_24h": "64109.4",
|
918
|
+
# "low_24h": "61857.6",
|
919
|
+
# "change_24h": "0.0239264900886327",
|
920
|
+
# "funding_time": 1726819200000
|
921
|
+
# },
|
922
|
+
# ]
|
923
|
+
# }
|
919
924
|
# }
|
920
|
-
# }
|
921
925
|
#
|
922
926
|
data = self.safe_value(response, 'data', {})
|
923
927
|
symbols = self.safe_value(data, 'symbols', [])
|
@@ -1192,33 +1196,34 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1192
1196
|
# swap
|
1193
1197
|
#
|
1194
1198
|
# {
|
1195
|
-
#
|
1196
|
-
#
|
1197
|
-
#
|
1198
|
-
#
|
1199
|
-
#
|
1200
|
-
#
|
1201
|
-
#
|
1202
|
-
#
|
1203
|
-
#
|
1204
|
-
#
|
1205
|
-
#
|
1206
|
-
#
|
1207
|
-
#
|
1208
|
-
#
|
1209
|
-
#
|
1210
|
-
#
|
1211
|
-
#
|
1212
|
-
#
|
1213
|
-
#
|
1214
|
-
#
|
1215
|
-
#
|
1216
|
-
#
|
1217
|
-
#
|
1218
|
-
#
|
1219
|
-
#
|
1220
|
-
#
|
1221
|
-
#
|
1199
|
+
# "symbol": "BTCUSDT",
|
1200
|
+
# "product_type": 1,
|
1201
|
+
# "open_timestamp": 1645977600000,
|
1202
|
+
# "expire_timestamp": 0,
|
1203
|
+
# "settle_timestamp": 0,
|
1204
|
+
# "base_currency": "BTC",
|
1205
|
+
# "quote_currency": "USDT",
|
1206
|
+
# "last_price": "63547.4",
|
1207
|
+
# "volume_24h": "110938430",
|
1208
|
+
# "turnover_24h": "7004836342.6944",
|
1209
|
+
# "index_price": "63587.85404255",
|
1210
|
+
# "index_name": "BTCUSDT",
|
1211
|
+
# "contract_size": "0.001",
|
1212
|
+
# "min_leverage": "1",
|
1213
|
+
# "max_leverage": "100",
|
1214
|
+
# "price_precision": "0.1",
|
1215
|
+
# "vol_precision": "1",
|
1216
|
+
# "max_volume": "1000000",
|
1217
|
+
# "min_volume": "1",
|
1218
|
+
# "funding_rate": "0.0000801",
|
1219
|
+
# "expected_funding_rate": "-0.0000035",
|
1220
|
+
# "open_interest": "278214",
|
1221
|
+
# "open_interest_value": "17555316.9355496",
|
1222
|
+
# "high_24h": "64109.4",
|
1223
|
+
# "low_24h": "61857.6",
|
1224
|
+
# "change_24h": "0.0239264900886327",
|
1225
|
+
# "funding_time": 1726819200000
|
1226
|
+
# }
|
1222
1227
|
#
|
1223
1228
|
result = self.safe_list(ticker, 'result', [])
|
1224
1229
|
average = self.safe_string_2(ticker, 'avg_price', 'index_price')
|
@@ -1307,27 +1312,43 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1307
1312
|
request['symbol'] = market['id']
|
1308
1313
|
response = self.publicGetContractPublicDetails(self.extend(request, params))
|
1309
1314
|
#
|
1310
|
-
#
|
1311
|
-
#
|
1312
|
-
#
|
1313
|
-
#
|
1314
|
-
#
|
1315
|
-
#
|
1316
|
-
#
|
1317
|
-
#
|
1318
|
-
#
|
1319
|
-
#
|
1320
|
-
#
|
1321
|
-
#
|
1322
|
-
#
|
1323
|
-
#
|
1324
|
-
#
|
1325
|
-
#
|
1326
|
-
#
|
1327
|
-
#
|
1328
|
-
#
|
1329
|
-
#
|
1330
|
-
#
|
1315
|
+
# {
|
1316
|
+
# "code": 1000,
|
1317
|
+
# "message": "Ok",
|
1318
|
+
# "data": {
|
1319
|
+
# "symbols": [
|
1320
|
+
# {
|
1321
|
+
# "symbol": "BTCUSDT",
|
1322
|
+
# "product_type": 1,
|
1323
|
+
# "open_timestamp": 1645977600000,
|
1324
|
+
# "expire_timestamp": 0,
|
1325
|
+
# "settle_timestamp": 0,
|
1326
|
+
# "base_currency": "BTC",
|
1327
|
+
# "quote_currency": "USDT",
|
1328
|
+
# "last_price": "63547.4",
|
1329
|
+
# "volume_24h": "110938430",
|
1330
|
+
# "turnover_24h": "7004836342.6944",
|
1331
|
+
# "index_price": "63587.85404255",
|
1332
|
+
# "index_name": "BTCUSDT",
|
1333
|
+
# "contract_size": "0.001",
|
1334
|
+
# "min_leverage": "1",
|
1335
|
+
# "max_leverage": "100",
|
1336
|
+
# "price_precision": "0.1",
|
1337
|
+
# "vol_precision": "1",
|
1338
|
+
# "max_volume": "1000000",
|
1339
|
+
# "min_volume": "1",
|
1340
|
+
# "funding_rate": "0.0000801",
|
1341
|
+
# "expected_funding_rate": "-0.0000035",
|
1342
|
+
# "open_interest": "278214",
|
1343
|
+
# "open_interest_value": "17555316.9355496",
|
1344
|
+
# "high_24h": "64109.4",
|
1345
|
+
# "low_24h": "61857.6",
|
1346
|
+
# "change_24h": "0.0239264900886327",
|
1347
|
+
# "funding_time": 1726819200000
|
1348
|
+
# },
|
1349
|
+
# ]
|
1350
|
+
# }
|
1351
|
+
# }
|
1331
1352
|
#
|
1332
1353
|
elif market['spot']:
|
1333
1354
|
request['symbol'] = market['id']
|
@@ -1414,43 +1435,43 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1414
1435
|
elif type == 'swap':
|
1415
1436
|
response = self.publicGetContractPublicDetails(params)
|
1416
1437
|
#
|
1417
|
-
#
|
1418
|
-
#
|
1419
|
-
#
|
1420
|
-
#
|
1421
|
-
#
|
1422
|
-
#
|
1423
|
-
#
|
1424
|
-
#
|
1425
|
-
#
|
1426
|
-
#
|
1427
|
-
#
|
1428
|
-
#
|
1429
|
-
#
|
1430
|
-
#
|
1431
|
-
#
|
1432
|
-
#
|
1433
|
-
#
|
1434
|
-
#
|
1435
|
-
#
|
1436
|
-
#
|
1437
|
-
#
|
1438
|
-
#
|
1439
|
-
#
|
1440
|
-
#
|
1441
|
-
#
|
1442
|
-
#
|
1443
|
-
#
|
1444
|
-
#
|
1445
|
-
#
|
1446
|
-
#
|
1447
|
-
#
|
1448
|
-
#
|
1449
|
-
#
|
1450
|
-
#
|
1451
|
-
#
|
1452
|
-
#
|
1453
|
-
#
|
1438
|
+
# {
|
1439
|
+
# "code": 1000,
|
1440
|
+
# "message": "Ok",
|
1441
|
+
# "data": {
|
1442
|
+
# "symbols": [
|
1443
|
+
# {
|
1444
|
+
# "symbol": "BTCUSDT",
|
1445
|
+
# "product_type": 1,
|
1446
|
+
# "open_timestamp": 1645977600000,
|
1447
|
+
# "expire_timestamp": 0,
|
1448
|
+
# "settle_timestamp": 0,
|
1449
|
+
# "base_currency": "BTC",
|
1450
|
+
# "quote_currency": "USDT",
|
1451
|
+
# "last_price": "63547.4",
|
1452
|
+
# "volume_24h": "110938430",
|
1453
|
+
# "turnover_24h": "7004836342.6944",
|
1454
|
+
# "index_price": "63587.85404255",
|
1455
|
+
# "index_name": "BTCUSDT",
|
1456
|
+
# "contract_size": "0.001",
|
1457
|
+
# "min_leverage": "1",
|
1458
|
+
# "max_leverage": "100",
|
1459
|
+
# "price_precision": "0.1",
|
1460
|
+
# "vol_precision": "1",
|
1461
|
+
# "max_volume": "1000000",
|
1462
|
+
# "min_volume": "1",
|
1463
|
+
# "funding_rate": "0.0000801",
|
1464
|
+
# "expected_funding_rate": "-0.0000035",
|
1465
|
+
# "open_interest": "278214",
|
1466
|
+
# "open_interest_value": "17555316.9355496",
|
1467
|
+
# "high_24h": "64109.4",
|
1468
|
+
# "low_24h": "61857.6",
|
1469
|
+
# "change_24h": "0.0239264900886327",
|
1470
|
+
# "funding_time": 1726819200000
|
1471
|
+
# },
|
1472
|
+
# ]
|
1473
|
+
# }
|
1474
|
+
# }
|
1454
1475
|
#
|
1455
1476
|
else:
|
1456
1477
|
raise NotSupported(self.id + ' fetchTickers() does not support ' + type + ' markets, only spot and swap markets are accepted')
|
@@ -2366,6 +2387,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2366
2387
|
:see: https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
2367
2388
|
:see: https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
2368
2389
|
:see: https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
|
2390
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-or-sl-order-signed
|
2369
2391
|
:param str symbol: unified symbol of the market to create an order in
|
2370
2392
|
:param str type: 'market', 'limit' or 'trailing' for swap markets only
|
2371
2393
|
:param str side: 'buy' or 'sell'
|
@@ -2383,6 +2405,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2383
2405
|
:param int [params.activation_price_type]: *swap trailing order only* 1: last price, 2: fair price, default is 1
|
2384
2406
|
:param str [params.trailingPercent]: *swap only* the percent to trail away from the current market price, min 0.1 max 5
|
2385
2407
|
:param str [params.trailingTriggerPrice]: *swap only* the price to trigger a trailing order, default uses the price argument
|
2408
|
+
:param str [params.stopLossPrice]: *swap only* the price to trigger a stop-loss order
|
2409
|
+
:param str [params.takeProfitPrice]: *swap only* the price to trigger a take-profit order
|
2410
|
+
:param int [params.plan_category]: *swap tp/sl only* 1: tp/sl, 2: position tp/sl, default is 1
|
2386
2411
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2387
2412
|
"""
|
2388
2413
|
self.load_markets()
|
@@ -2390,6 +2415,10 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2390
2415
|
result = self.handle_margin_mode_and_params('createOrder', params)
|
2391
2416
|
marginMode = self.safe_string(result, 0)
|
2392
2417
|
triggerPrice = self.safe_string_n(params, ['triggerPrice', 'stopPrice', 'trigger_price'])
|
2418
|
+
stopLossPrice = self.safe_string(params, 'stopLossPrice')
|
2419
|
+
takeProfitPrice = self.safe_string(params, 'takeProfitPrice')
|
2420
|
+
isStopLoss = stopLossPrice is not None
|
2421
|
+
isTakeProfit = takeProfitPrice is not None
|
2393
2422
|
isTriggerOrder = triggerPrice is not None
|
2394
2423
|
response = None
|
2395
2424
|
if market['spot']:
|
@@ -2402,6 +2431,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2402
2431
|
swapRequest = self.create_swap_order_request(symbol, type, side, amount, price, params)
|
2403
2432
|
if isTriggerOrder:
|
2404
2433
|
response = self.privatePostContractPrivateSubmitPlanOrder(swapRequest)
|
2434
|
+
elif isStopLoss or isTakeProfit:
|
2435
|
+
response = self.privatePostContractPrivateSubmitTpSlOrder(swapRequest)
|
2405
2436
|
else:
|
2406
2437
|
response = self.privatePostContractPrivateSubmitOrder(swapRequest)
|
2407
2438
|
#
|
@@ -2496,8 +2527,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2496
2527
|
:see: https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
2497
2528
|
:see: https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
2498
2529
|
:see: https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
|
2530
|
+
:see: https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-or-sl-order-signed
|
2499
2531
|
:param str symbol: unified symbol of the market to create an order in
|
2500
|
-
:param str type: 'market', 'limit' or '
|
2532
|
+
:param str type: 'market', 'limit', 'trailing', 'stop_loss', or 'take_profit'
|
2501
2533
|
:param str side: 'buy' or 'sell'
|
2502
2534
|
:param float amount: how much of currency you want to trade in units of base currency
|
2503
2535
|
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
@@ -2512,9 +2544,20 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2512
2544
|
:param int [params.activation_price_type]: *swap trailing order only* 1: last price, 2: fair price, default is 1
|
2513
2545
|
:param str [params.trailingPercent]: *swap only* the percent to trail away from the current market price, min 0.1 max 5
|
2514
2546
|
:param str [params.trailingTriggerPrice]: *swap only* the price to trigger a trailing order, default uses the price argument
|
2547
|
+
:param str [params.stopLossPrice]: *swap only* the price to trigger a stop-loss order
|
2548
|
+
:param str [params.takeProfitPrice]: *swap only* the price to trigger a take-profit order
|
2549
|
+
:param int [params.plan_category]: *swap tp/sl only* 1: tp/sl, 2: position tp/sl, default is 1
|
2515
2550
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2516
2551
|
"""
|
2517
2552
|
market = self.market(symbol)
|
2553
|
+
stopLossPrice = self.safe_string(params, 'stopLossPrice')
|
2554
|
+
takeProfitPrice = self.safe_string(params, 'takeProfitPrice')
|
2555
|
+
isStopLoss = stopLossPrice is not None
|
2556
|
+
isTakeProfit = takeProfitPrice is not None
|
2557
|
+
if isStopLoss:
|
2558
|
+
type = 'stop_loss'
|
2559
|
+
elif isTakeProfit:
|
2560
|
+
type = 'take_profit'
|
2518
2561
|
request: dict = {
|
2519
2562
|
'symbol': market['id'],
|
2520
2563
|
'type': type,
|
@@ -2524,7 +2567,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2524
2567
|
mode = self.safe_integer(params, 'mode') # only for swap
|
2525
2568
|
isMarketOrder = type == 'market'
|
2526
2569
|
postOnly = None
|
2527
|
-
reduceOnly = self.
|
2570
|
+
reduceOnly = self.safe_bool(params, 'reduceOnly')
|
2528
2571
|
isExchangeSpecificPo = (mode == 4)
|
2529
2572
|
postOnly, params = self.handle_post_only(isMarketOrder, isExchangeSpecificPo, params)
|
2530
2573
|
ioc = ((timeInForce == 'IOC') or (mode == 3))
|
@@ -2563,6 +2606,18 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2563
2606
|
request['price_way'] = 1
|
2564
2607
|
else:
|
2565
2608
|
request['price_way'] = 2
|
2609
|
+
marginMode = None
|
2610
|
+
marginMode, params = self.handle_margin_mode_and_params('createOrder', params, 'cross')
|
2611
|
+
if isStopLoss or isTakeProfit:
|
2612
|
+
reduceOnly = True
|
2613
|
+
request['price_type'] = self.safe_integer(params, 'price_type', 1)
|
2614
|
+
request['executive_price'] = self.price_to_precision(symbol, price)
|
2615
|
+
if isStopLoss:
|
2616
|
+
request['trigger_price'] = self.price_to_precision(symbol, stopLossPrice)
|
2617
|
+
else:
|
2618
|
+
request['trigger_price'] = self.price_to_precision(symbol, takeProfitPrice)
|
2619
|
+
else:
|
2620
|
+
request['open_type'] = marginMode
|
2566
2621
|
if side == 'buy':
|
2567
2622
|
if reduceOnly:
|
2568
2623
|
request['side'] = 2 # buy close short
|
@@ -2573,15 +2628,12 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2573
2628
|
request['side'] = 3 # sell close long
|
2574
2629
|
else:
|
2575
2630
|
request['side'] = 4 # sell open short
|
2576
|
-
marginMode = None
|
2577
|
-
marginMode, params = self.handle_margin_mode_and_params('createOrder', params, 'cross')
|
2578
|
-
request['open_type'] = marginMode
|
2579
2631
|
clientOrderId = self.safe_string(params, 'clientOrderId')
|
2580
2632
|
if clientOrderId is not None:
|
2581
2633
|
params = self.omit(params, 'clientOrderId')
|
2582
2634
|
request['client_order_id'] = clientOrderId
|
2583
2635
|
leverage = self.safe_integer(params, 'leverage')
|
2584
|
-
params = self.omit(params, ['timeInForce', 'postOnly', 'reduceOnly', 'leverage', 'trailingTriggerPrice', 'trailingPercent', 'triggerPrice', 'stopPrice'])
|
2636
|
+
params = self.omit(params, ['timeInForce', 'postOnly', 'reduceOnly', 'leverage', 'trailingTriggerPrice', 'trailingPercent', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice'])
|
2585
2637
|
if leverage is not None:
|
2586
2638
|
request['leverage'] = self.number_to_string(leverage)
|
2587
2639
|
elif isTriggerOrder:
|
ccxt/bybit.py
CHANGED
@@ -114,7 +114,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
114
114
|
'fetchOpenOrders': True,
|
115
115
|
'fetchOption': True,
|
116
116
|
'fetchOptionChain': True,
|
117
|
-
'fetchOrder':
|
117
|
+
'fetchOrder': True,
|
118
118
|
'fetchOrderBook': True,
|
119
119
|
'fetchOrders': False,
|
120
120
|
'fetchOrderTrades': True,
|
@@ -1613,12 +1613,19 @@ class bybit(Exchange, ImplicitAPI):
|
|
1613
1613
|
def fetch_future_markets(self, params):
|
1614
1614
|
params = self.extend(params)
|
1615
1615
|
params['limit'] = 1000 # minimize number of requests
|
1616
|
+
preLaunchMarkets = []
|
1616
1617
|
usePrivateInstrumentsInfo = self.safe_bool(self.options, 'usePrivateInstrumentsInfo', False)
|
1617
1618
|
response: dict = None
|
1618
1619
|
if usePrivateInstrumentsInfo:
|
1619
1620
|
response = self.privateGetV5MarketInstrumentsInfo(params)
|
1620
1621
|
else:
|
1621
|
-
|
1622
|
+
linearPromises = [
|
1623
|
+
self.publicGetV5MarketInstrumentsInfo(params),
|
1624
|
+
self.publicGetV5MarketInstrumentsInfo(self.extend(params, {'status': 'PreLaunch'})),
|
1625
|
+
]
|
1626
|
+
promises = linearPromises
|
1627
|
+
response = self.safe_dict(promises, 0, {})
|
1628
|
+
preLaunchMarkets = self.safe_dict(promises, 1, {})
|
1622
1629
|
data = self.safe_dict(response, 'result', {})
|
1623
1630
|
markets = self.safe_list(data, 'list', [])
|
1624
1631
|
paginationCursor = self.safe_string(data, 'nextPageCursor')
|
@@ -1681,6 +1688,9 @@ class bybit(Exchange, ImplicitAPI):
|
|
1681
1688
|
# "time": 1672712495660
|
1682
1689
|
# }
|
1683
1690
|
#
|
1691
|
+
preLaunchData = self.safe_dict(preLaunchMarkets, 'result', {})
|
1692
|
+
preLaunchMarketsList = self.safe_list(preLaunchData, 'list', [])
|
1693
|
+
markets = self.array_concat(markets, preLaunchMarketsList)
|
1684
1694
|
result = []
|
1685
1695
|
category = self.safe_string(data, 'category')
|
1686
1696
|
for i in range(0, len(markets)):
|
@@ -4526,13 +4536,84 @@ class bybit(Exchange, ImplicitAPI):
|
|
4526
4536
|
:param str id: the order id
|
4527
4537
|
:param str symbol: unified symbol of the market the order was made in
|
4528
4538
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4539
|
+
:param dict [params.acknowledged]: to suppress the warning, set to True
|
4529
4540
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
4530
4541
|
"""
|
4531
|
-
|
4532
|
-
enableUnifiedAccount = self.
|
4533
|
-
|
4534
|
-
|
4535
|
-
|
4542
|
+
self.load_markets()
|
4543
|
+
enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
|
4544
|
+
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
4545
|
+
if not isUnifiedAccount:
|
4546
|
+
return self.fetch_order_classic(id, symbol, params)
|
4547
|
+
acknowledge = False
|
4548
|
+
acknowledge, params = self.handle_option_and_params(params, 'fetchOrder', 'acknowledged')
|
4549
|
+
if not acknowledge:
|
4550
|
+
raise ArgumentsRequired(self.id + ' fetchOrder() can only access an order if it is in last 500 orders(of any status) for your account. Set params["acknowledged"] = True to hide self warning. Alternatively, we suggest to use fetchOpenOrder or fetchClosedOrder')
|
4551
|
+
market = self.market(symbol)
|
4552
|
+
marketType = None
|
4553
|
+
marketType, params = self.get_bybit_type('fetchOrder', market, params)
|
4554
|
+
request: dict = {
|
4555
|
+
'symbol': market['id'],
|
4556
|
+
'orderId': id,
|
4557
|
+
'category': marketType,
|
4558
|
+
}
|
4559
|
+
isTrigger = None
|
4560
|
+
isTrigger, params = self.handle_param_bool_2(params, 'trigger', 'stop', False)
|
4561
|
+
if isTrigger:
|
4562
|
+
request['orderFilter'] = 'StopOrder'
|
4563
|
+
response = self.privateGetV5OrderRealtime(self.extend(request, params))
|
4564
|
+
#
|
4565
|
+
# {
|
4566
|
+
# "retCode": 0,
|
4567
|
+
# "retMsg": "OK",
|
4568
|
+
# "result": {
|
4569
|
+
# "nextPageCursor": "1321052653536515584%3A1672217748287%2C1321052653536515584%3A1672217748287",
|
4570
|
+
# "category": "spot",
|
4571
|
+
# "list": [
|
4572
|
+
# {
|
4573
|
+
# "symbol": "ETHUSDT",
|
4574
|
+
# "orderType": "Limit",
|
4575
|
+
# "orderLinkId": "1672217748277652",
|
4576
|
+
# "orderId": "1321052653536515584",
|
4577
|
+
# "cancelType": "UNKNOWN",
|
4578
|
+
# "avgPrice": "",
|
4579
|
+
# "stopOrderType": "tpslOrder",
|
4580
|
+
# "lastPriceOnCreated": "",
|
4581
|
+
# "orderStatus": "Cancelled",
|
4582
|
+
# "takeProfit": "",
|
4583
|
+
# "cumExecValue": "0",
|
4584
|
+
# "triggerDirection": 0,
|
4585
|
+
# "isLeverage": "0",
|
4586
|
+
# "rejectReason": "",
|
4587
|
+
# "price": "1000",
|
4588
|
+
# "orderIv": "",
|
4589
|
+
# "createdTime": "1672217748287",
|
4590
|
+
# "tpTriggerBy": "",
|
4591
|
+
# "positionIdx": 0,
|
4592
|
+
# "timeInForce": "GTC",
|
4593
|
+
# "leavesValue": "500",
|
4594
|
+
# "updatedTime": "1672217748287",
|
4595
|
+
# "side": "Buy",
|
4596
|
+
# "triggerPrice": "1500",
|
4597
|
+
# "cumExecFee": "0",
|
4598
|
+
# "leavesQty": "0",
|
4599
|
+
# "slTriggerBy": "",
|
4600
|
+
# "closeOnTrigger": False,
|
4601
|
+
# "cumExecQty": "0",
|
4602
|
+
# "reduceOnly": False,
|
4603
|
+
# "qty": "0.5",
|
4604
|
+
# "stopLoss": "",
|
4605
|
+
# "triggerBy": "1192.5"
|
4606
|
+
# }
|
4607
|
+
# ]
|
4608
|
+
# },
|
4609
|
+
# "retExtInfo": {},
|
4610
|
+
# "time": 1672219526294
|
4611
|
+
# }
|
4612
|
+
#
|
4613
|
+
result = self.safe_dict(response, 'result', {})
|
4614
|
+
innerList = self.safe_list(result, 'list', [])
|
4615
|
+
order = self.safe_dict(innerList, 0, {})
|
4616
|
+
return self.parse_order(order, market)
|
4536
4617
|
|
4537
4618
|
def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
4538
4619
|
res = self.is_unified_enabled()
|
ccxt/coinbase.py
CHANGED
@@ -751,28 +751,26 @@ class coinbase(Exchange, ImplicitAPI):
|
|
751
751
|
|
752
752
|
def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
753
753
|
"""
|
754
|
-
|
755
|
-
:see: https://docs.
|
754
|
+
Fetch all withdrawals made from an account. Won't return crypto withdrawals. Use fetchLedger for those.
|
755
|
+
:see: https://docs.cdp.coinbase.com/coinbase-app/docs/api-withdrawals#list-withdrawals
|
756
756
|
:param str code: unified currency code
|
757
757
|
:param int [since]: the earliest time in ms to fetch withdrawals for
|
758
758
|
:param int [limit]: the maximum number of withdrawals structures to retrieve
|
759
759
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
760
760
|
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
761
761
|
"""
|
762
|
-
# fiat only, for crypto transactions use fetchLedger
|
763
762
|
return self.fetch_transactions_with_method('v2PrivateGetAccountsAccountIdWithdrawals', code, since, limit, params)
|
764
763
|
|
765
764
|
def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
766
765
|
"""
|
767
|
-
|
768
|
-
:see: https://docs.
|
766
|
+
Fetch all fiat deposits made to an account. Won't return crypto deposits or staking rewards. Use fetchLedger for those.
|
767
|
+
:see: https://docs.cdp.coinbase.com/coinbase-app/docs/api-deposits#list-deposits
|
769
768
|
:param str code: unified currency code
|
770
769
|
:param int [since]: the earliest time in ms to fetch deposits for
|
771
770
|
:param int [limit]: the maximum number of deposits structures to retrieve
|
772
771
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
773
772
|
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
774
773
|
"""
|
775
|
-
# fiat only, for crypto transactions use fetchLedger
|
776
774
|
return self.fetch_transactions_with_method('v2PrivateGetAccountsAccountIdDeposits', code, since, limit, params)
|
777
775
|
|
778
776
|
def parse_transaction_status(self, status: Str):
|
@@ -2172,8 +2170,8 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2172
2170
|
|
2173
2171
|
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
2174
2172
|
"""
|
2175
|
-
|
2176
|
-
:see: https://docs.
|
2173
|
+
Fetch the history of changes, i.e. actions done by the user or operations that altered the balance. Will return staking rewards, and crypto deposits or withdrawals.
|
2174
|
+
:see: https://docs.cdp.coinbase.com/coinbase-app/docs/api-transactions#list-transactions
|
2177
2175
|
:param str [code]: unified currency code, default is None
|
2178
2176
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
2179
2177
|
:param int [limit]: max number of ledger entries to return, default is None
|
ccxt/kraken.py
CHANGED
@@ -249,6 +249,8 @@ class kraken(Exchange, ImplicitAPI):
|
|
249
249
|
'XDG': 'DOGE',
|
250
250
|
},
|
251
251
|
'options': {
|
252
|
+
'timeDifference': 0, # the difference between system clock and Binance clock
|
253
|
+
'adjustForTimeDifference': False, # controls the adjustment logic upon instantiation
|
252
254
|
'marketsByAltname': {},
|
253
255
|
'delistedMarketsById': {},
|
254
256
|
# cannot withdraw/deposit these
|
@@ -477,6 +479,8 @@ class kraken(Exchange, ImplicitAPI):
|
|
477
479
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
478
480
|
:returns dict[]: an array of objects representing market data
|
479
481
|
"""
|
482
|
+
if self.options['adjustForTimeDifference']:
|
483
|
+
self.load_time_difference()
|
480
484
|
response = self.publicGetAssetPairs(params)
|
481
485
|
#
|
482
486
|
# {
|
@@ -2941,7 +2945,7 @@ class kraken(Exchange, ImplicitAPI):
|
|
2941
2945
|
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
2942
2946
|
|
2943
2947
|
def nonce(self):
|
2944
|
-
return self.milliseconds()
|
2948
|
+
return self.milliseconds() - self.options['timeDifference']
|
2945
2949
|
|
2946
2950
|
def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
|
2947
2951
|
if code == 520:
|
ccxt/lykke.py
CHANGED
@@ -667,9 +667,9 @@ class lykke(Exchange, ImplicitAPI):
|
|
667
667
|
currencyId = self.safe_string(balance, 'assetId')
|
668
668
|
code = self.safe_currency_code(currencyId)
|
669
669
|
account = self.account()
|
670
|
-
|
670
|
+
total = self.safe_string(balance, 'available')
|
671
671
|
used = self.safe_string(balance, 'reserved')
|
672
|
-
account['
|
672
|
+
account['total'] = total
|
673
673
|
account['used'] = used
|
674
674
|
result[code] = account
|
675
675
|
return self.safe_balance(result)
|