ccxt 4.4.37__py2.py3-none-any.whl → 4.4.39__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/bingx.py +0 -1
- ccxt/abstract/digifinex.py +1 -0
- ccxt/abstract/mexc.py +1 -0
- ccxt/abstract/woo.py +2 -2
- ccxt/alpaca.py +74 -3
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/alpaca.py +74 -3
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +0 -2
- ccxt/async_support/bingx.py +89 -8
- ccxt/async_support/bitget.py +2 -4
- ccxt/async_support/bithumb.py +1 -1
- ccxt/async_support/bitmart.py +160 -13
- ccxt/async_support/bybit.py +3 -2
- ccxt/async_support/digifinex.py +57 -18
- ccxt/async_support/htx.py +154 -32
- ccxt/async_support/kucoin.py +76 -2
- ccxt/async_support/kucoinfutures.py +92 -5
- ccxt/async_support/mexc.py +36 -25
- ccxt/async_support/ndax.py +5 -1
- ccxt/async_support/okx.py +1 -1
- ccxt/async_support/probit.py +3 -1
- ccxt/async_support/woo.py +6 -6
- ccxt/base/exchange.py +24 -11
- ccxt/binance.py +0 -2
- ccxt/bingx.py +89 -8
- ccxt/bitget.py +2 -4
- ccxt/bithumb.py +1 -1
- ccxt/bitmart.py +160 -13
- ccxt/bybit.py +3 -2
- ccxt/digifinex.py +57 -18
- ccxt/htx.py +154 -32
- ccxt/kucoin.py +76 -2
- ccxt/kucoinfutures.py +92 -5
- ccxt/mexc.py +36 -25
- ccxt/ndax.py +5 -1
- ccxt/okx.py +1 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/woo.py +1 -1
- ccxt/probit.py +3 -1
- ccxt/test/tests_async.py +5 -1
- ccxt/test/tests_sync.py +5 -1
- ccxt/woo.py +6 -6
- {ccxt-4.4.37.dist-info → ccxt-4.4.39.dist-info}/METADATA +4 -4
- {ccxt-4.4.37.dist-info → ccxt-4.4.39.dist-info}/RECORD +49 -49
- {ccxt-4.4.37.dist-info → ccxt-4.4.39.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.37.dist-info → ccxt-4.4.39.dist-info}/WHEEL +0 -0
- {ccxt-4.4.37.dist-info → ccxt-4.4.39.dist-info}/top_level.txt +0 -0
ccxt/htx.py
CHANGED
@@ -1250,6 +1250,128 @@ class htx(Exchange, ImplicitAPI):
|
|
1250
1250
|
'BIFI': 'BITCOINFILE', # conflict with Beefy.Finance https://github.com/ccxt/ccxt/issues/8706
|
1251
1251
|
'FUD': 'FTX Users Debt',
|
1252
1252
|
},
|
1253
|
+
'features': {
|
1254
|
+
'spot': {
|
1255
|
+
'sandbox': True,
|
1256
|
+
'createOrder': {
|
1257
|
+
'marginMode': True,
|
1258
|
+
'triggerPrice': True,
|
1259
|
+
'triggerDirection': True,
|
1260
|
+
'triggerPriceType': None,
|
1261
|
+
'stopLossPrice': False, # todo: add support by triggerprice
|
1262
|
+
'takeProfitPrice': False,
|
1263
|
+
'attachedStopLossTakeProfit': None,
|
1264
|
+
'timeInForce': {
|
1265
|
+
'IOC': True,
|
1266
|
+
'FOK': True,
|
1267
|
+
'PO': True,
|
1268
|
+
'GTD': False,
|
1269
|
+
},
|
1270
|
+
'hedged': False,
|
1271
|
+
'trailing': False,
|
1272
|
+
# exchange-specific features
|
1273
|
+
'iceberg': False,
|
1274
|
+
'selfTradePrevention': True,
|
1275
|
+
},
|
1276
|
+
'createOrders': {
|
1277
|
+
'max': 10,
|
1278
|
+
},
|
1279
|
+
'fetchMyTrades': {
|
1280
|
+
'marginMode': False,
|
1281
|
+
'limit': 500,
|
1282
|
+
'daysBack': 120,
|
1283
|
+
'untilDays': 2,
|
1284
|
+
},
|
1285
|
+
'fetchOrder': {
|
1286
|
+
'marginMode': False,
|
1287
|
+
'trigger': False,
|
1288
|
+
'trailing': False,
|
1289
|
+
},
|
1290
|
+
'fetchOpenOrders': {
|
1291
|
+
'marginMode': False,
|
1292
|
+
'trigger': True,
|
1293
|
+
'trailing': False,
|
1294
|
+
'limit': 500,
|
1295
|
+
},
|
1296
|
+
'fetchOrders': {
|
1297
|
+
'marginMode': False,
|
1298
|
+
'trigger': True,
|
1299
|
+
'trailing': False,
|
1300
|
+
'limit': 500,
|
1301
|
+
'untilDays': 2,
|
1302
|
+
'daysBack': 180,
|
1303
|
+
},
|
1304
|
+
'fetchClosedOrders': {
|
1305
|
+
'marginMode': False,
|
1306
|
+
'trigger': True,
|
1307
|
+
'trailing': False,
|
1308
|
+
'untilDays': 2,
|
1309
|
+
'limit': 500,
|
1310
|
+
'daysBackClosed': 180,
|
1311
|
+
'daysBackCanceled': 1 / 12,
|
1312
|
+
},
|
1313
|
+
'fetchOHLCV': {
|
1314
|
+
'limit': 1000, # 2000 for non-historical
|
1315
|
+
},
|
1316
|
+
},
|
1317
|
+
'forDerivatives': {
|
1318
|
+
'extends': 'spot',
|
1319
|
+
'createOrder': {
|
1320
|
+
'stopLossPrice': True,
|
1321
|
+
'takeProfitPrice': True,
|
1322
|
+
'trailing': True,
|
1323
|
+
'hedged': True,
|
1324
|
+
# 'leverage': True, # todo
|
1325
|
+
},
|
1326
|
+
'createOrders': {
|
1327
|
+
'max': 25,
|
1328
|
+
},
|
1329
|
+
'fetchOrder': {
|
1330
|
+
'marginMode': True,
|
1331
|
+
},
|
1332
|
+
'fetchOpenOrders': {
|
1333
|
+
'marginMode': True,
|
1334
|
+
'trigger': False,
|
1335
|
+
'trailing': False,
|
1336
|
+
'limit': 50,
|
1337
|
+
},
|
1338
|
+
'fetchOrders': {
|
1339
|
+
'marginMode': True,
|
1340
|
+
'trigger': False,
|
1341
|
+
'trailing': False,
|
1342
|
+
'limit': 50,
|
1343
|
+
'daysBack': 90,
|
1344
|
+
},
|
1345
|
+
'fetchClosedOrders': {
|
1346
|
+
'marginMode': True,
|
1347
|
+
'trigger': False,
|
1348
|
+
'trailing': False,
|
1349
|
+
'untilDays': 2,
|
1350
|
+
'limit': 50,
|
1351
|
+
'daysBackClosed': 90,
|
1352
|
+
'daysBackCanceled': 1 / 12,
|
1353
|
+
},
|
1354
|
+
'fetchOHLCV': {
|
1355
|
+
'limit': 2000,
|
1356
|
+
},
|
1357
|
+
},
|
1358
|
+
'swap': {
|
1359
|
+
'linear': {
|
1360
|
+
'extends': 'forDerivatives',
|
1361
|
+
},
|
1362
|
+
'inverse': {
|
1363
|
+
'extends': 'forDerivatives',
|
1364
|
+
},
|
1365
|
+
},
|
1366
|
+
'future': {
|
1367
|
+
'linear': {
|
1368
|
+
'extends': 'forDerivatives',
|
1369
|
+
},
|
1370
|
+
'inverse': {
|
1371
|
+
'extends': 'forDerivatives',
|
1372
|
+
},
|
1373
|
+
},
|
1374
|
+
},
|
1253
1375
|
})
|
1254
1376
|
|
1255
1377
|
def fetch_status(self, params={}):
|
@@ -3864,11 +3986,11 @@ class htx(Exchange, ImplicitAPI):
|
|
3864
3986
|
'status': '0', # support multiple query seperated by ',',such as '3,4,5', 0: all. 3. Have sumbmitted the orders; 4. Orders partially matched; 5. Orders cancelled with partially matched; 6. Orders fully matched; 7. Orders cancelled
|
3865
3987
|
}
|
3866
3988
|
response = None
|
3867
|
-
|
3989
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
3868
3990
|
stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
|
3869
3991
|
trailing = self.safe_bool(params, 'trailing', False)
|
3870
3992
|
params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger'])
|
3871
|
-
if
|
3993
|
+
if trigger or stopLossTakeProfit or trailing:
|
3872
3994
|
if limit is not None:
|
3873
3995
|
request['page_size'] = limit
|
3874
3996
|
request['contract_code'] = market['id']
|
@@ -3885,7 +4007,7 @@ class htx(Exchange, ImplicitAPI):
|
|
3885
4007
|
marginMode, params = self.handle_margin_mode_and_params('fetchContractOrders', params)
|
3886
4008
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
3887
4009
|
if marginMode == 'isolated':
|
3888
|
-
if
|
4010
|
+
if trigger:
|
3889
4011
|
response = self.contractPrivatePostLinearSwapApiV1SwapTriggerHisorders(self.extend(request, params))
|
3890
4012
|
elif stopLossTakeProfit:
|
3891
4013
|
response = self.contractPrivatePostLinearSwapApiV1SwapTpslHisorders(self.extend(request, params))
|
@@ -3894,7 +4016,7 @@ class htx(Exchange, ImplicitAPI):
|
|
3894
4016
|
else:
|
3895
4017
|
response = self.contractPrivatePostLinearSwapApiV3SwapHisorders(self.extend(request, params))
|
3896
4018
|
elif marginMode == 'cross':
|
3897
|
-
if
|
4019
|
+
if trigger:
|
3898
4020
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossTriggerHisorders(self.extend(request, params))
|
3899
4021
|
elif stopLossTakeProfit:
|
3900
4022
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossTpslHisorders(self.extend(request, params))
|
@@ -3904,7 +4026,7 @@ class htx(Exchange, ImplicitAPI):
|
|
3904
4026
|
response = self.contractPrivatePostLinearSwapApiV3SwapCrossHisorders(self.extend(request, params))
|
3905
4027
|
elif market['inverse']:
|
3906
4028
|
if market['swap']:
|
3907
|
-
if
|
4029
|
+
if trigger:
|
3908
4030
|
response = self.contractPrivatePostSwapApiV1SwapTriggerHisorders(self.extend(request, params))
|
3909
4031
|
elif stopLossTakeProfit:
|
3910
4032
|
response = self.contractPrivatePostSwapApiV1SwapTpslHisorders(self.extend(request, params))
|
@@ -3914,7 +4036,7 @@ class htx(Exchange, ImplicitAPI):
|
|
3914
4036
|
response = self.contractPrivatePostSwapApiV3SwapHisorders(self.extend(request, params))
|
3915
4037
|
elif market['future']:
|
3916
4038
|
request['symbol'] = market['settleId']
|
3917
|
-
if
|
4039
|
+
if trigger:
|
3918
4040
|
response = self.contractPrivatePostApiV1ContractTriggerHisorders(self.extend(request, params))
|
3919
4041
|
elif stopLossTakeProfit:
|
3920
4042
|
response = self.contractPrivatePostApiV1ContractTpslHisorders(self.extend(request, params))
|
@@ -4090,7 +4212,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4090
4212
|
:param int [since]: the earliest time in ms to fetch orders for
|
4091
4213
|
:param int [limit]: the maximum number of order structures to retrieve
|
4092
4214
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4093
|
-
:param bool [params.
|
4215
|
+
:param bool [params.trigger]: *contract only* if the orders are trigger trigger orders or not
|
4094
4216
|
:param bool [params.stopLossTakeProfit]: *contract only* if the orders are stop-loss or take-profit orders
|
4095
4217
|
:param int [params.until]: the latest time in ms to fetch entries for
|
4096
4218
|
:param boolean [params.trailing]: *contract only* set to True if you want to fetch trailing stop orders
|
@@ -4156,7 +4278,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4156
4278
|
:param int [since]: the earliest time in ms to fetch open orders for
|
4157
4279
|
:param int [limit]: the maximum number of open order structures to retrieve
|
4158
4280
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4159
|
-
:param bool [params.
|
4281
|
+
:param bool [params.trigger]: *contract only* if the orders are trigger trigger orders or not
|
4160
4282
|
:param bool [params.stopLossTakeProfit]: *contract only* if the orders are stop-loss or take-profit orders
|
4161
4283
|
:param boolean [params.trailing]: *contract only* set to True if you want to fetch trailing stop orders
|
4162
4284
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -4194,7 +4316,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4194
4316
|
if limit is not None:
|
4195
4317
|
request['page_size'] = limit
|
4196
4318
|
request['contract_code'] = market['id']
|
4197
|
-
|
4319
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
4198
4320
|
stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
|
4199
4321
|
trailing = self.safe_bool(params, 'trailing', False)
|
4200
4322
|
params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger'])
|
@@ -4203,7 +4325,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4203
4325
|
marginMode, params = self.handle_margin_mode_and_params('fetchOpenOrders', params)
|
4204
4326
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
4205
4327
|
if marginMode == 'isolated':
|
4206
|
-
if
|
4328
|
+
if trigger:
|
4207
4329
|
response = self.contractPrivatePostLinearSwapApiV1SwapTriggerOpenorders(self.extend(request, params))
|
4208
4330
|
elif stopLossTakeProfit:
|
4209
4331
|
response = self.contractPrivatePostLinearSwapApiV1SwapTpslOpenorders(self.extend(request, params))
|
@@ -4212,7 +4334,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4212
4334
|
else:
|
4213
4335
|
response = self.contractPrivatePostLinearSwapApiV1SwapOpenorders(self.extend(request, params))
|
4214
4336
|
elif marginMode == 'cross':
|
4215
|
-
if
|
4337
|
+
if trigger:
|
4216
4338
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossTriggerOpenorders(self.extend(request, params))
|
4217
4339
|
elif stopLossTakeProfit:
|
4218
4340
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossTpslOpenorders(self.extend(request, params))
|
@@ -4222,7 +4344,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4222
4344
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossOpenorders(self.extend(request, params))
|
4223
4345
|
elif market['inverse']:
|
4224
4346
|
if market['swap']:
|
4225
|
-
if
|
4347
|
+
if trigger:
|
4226
4348
|
response = self.contractPrivatePostSwapApiV1SwapTriggerOpenorders(self.extend(request, params))
|
4227
4349
|
elif stopLossTakeProfit:
|
4228
4350
|
response = self.contractPrivatePostSwapApiV1SwapTpslOpenorders(self.extend(request, params))
|
@@ -4232,7 +4354,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4232
4354
|
response = self.contractPrivatePostSwapApiV1SwapOpenorders(self.extend(request, params))
|
4233
4355
|
elif market['future']:
|
4234
4356
|
request['symbol'] = market['settleId']
|
4235
|
-
if
|
4357
|
+
if trigger:
|
4236
4358
|
response = self.contractPrivatePostApiV1ContractTriggerOpenorders(self.extend(request, params))
|
4237
4359
|
elif stopLossTakeProfit:
|
4238
4360
|
response = self.contractPrivatePostApiV1ContractTpslOpenorders(self.extend(request, params))
|
@@ -4958,7 +5080,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4958
5080
|
if triggerPrice is None:
|
4959
5081
|
stopOrderTypes = self.safe_value(options, 'stopOrderTypes', {})
|
4960
5082
|
if orderType in stopOrderTypes:
|
4961
|
-
raise ArgumentsRequired(self.id + ' createOrder() requires a triggerPrice for a
|
5083
|
+
raise ArgumentsRequired(self.id + ' createOrder() requires a triggerPrice for a trigger order')
|
4962
5084
|
else:
|
4963
5085
|
defaultOperator = 'lte' if (side == 'sell') else 'gte'
|
4964
5086
|
stopOperator = self.safe_string(params, 'operator', defaultOperator)
|
@@ -5394,7 +5516,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5394
5516
|
:param str id: order id
|
5395
5517
|
:param str symbol: unified symbol of the market the order was made in
|
5396
5518
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5397
|
-
:param boolean [params.
|
5519
|
+
:param boolean [params.trigger]: *contract only* if the order is a trigger trigger order or not
|
5398
5520
|
:param boolean [params.stopLossTakeProfit]: *contract only* if the order is a stop-loss or take-profit order
|
5399
5521
|
:param boolean [params.trailing]: *contract only* set to True if you want to cancel a trailing order
|
5400
5522
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -5440,7 +5562,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5440
5562
|
request['symbol'] = market['settleId']
|
5441
5563
|
else:
|
5442
5564
|
request['contract_code'] = market['id']
|
5443
|
-
|
5565
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
5444
5566
|
stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
|
5445
5567
|
trailing = self.safe_bool(params, 'trailing', False)
|
5446
5568
|
params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger'])
|
@@ -5449,7 +5571,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5449
5571
|
marginMode, params = self.handle_margin_mode_and_params('cancelOrder', params)
|
5450
5572
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
5451
5573
|
if marginMode == 'isolated':
|
5452
|
-
if
|
5574
|
+
if trigger:
|
5453
5575
|
response = self.contractPrivatePostLinearSwapApiV1SwapTriggerCancel(self.extend(request, params))
|
5454
5576
|
elif stopLossTakeProfit:
|
5455
5577
|
response = self.contractPrivatePostLinearSwapApiV1SwapTpslCancel(self.extend(request, params))
|
@@ -5458,7 +5580,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5458
5580
|
else:
|
5459
5581
|
response = self.contractPrivatePostLinearSwapApiV1SwapCancel(self.extend(request, params))
|
5460
5582
|
elif marginMode == 'cross':
|
5461
|
-
if
|
5583
|
+
if trigger:
|
5462
5584
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossTriggerCancel(self.extend(request, params))
|
5463
5585
|
elif stopLossTakeProfit:
|
5464
5586
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossTpslCancel(self.extend(request, params))
|
@@ -5468,7 +5590,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5468
5590
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossCancel(self.extend(request, params))
|
5469
5591
|
elif market['inverse']:
|
5470
5592
|
if market['swap']:
|
5471
|
-
if
|
5593
|
+
if trigger:
|
5472
5594
|
response = self.contractPrivatePostSwapApiV1SwapTriggerCancel(self.extend(request, params))
|
5473
5595
|
elif stopLossTakeProfit:
|
5474
5596
|
response = self.contractPrivatePostSwapApiV1SwapTpslCancel(self.extend(request, params))
|
@@ -5477,7 +5599,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5477
5599
|
else:
|
5478
5600
|
response = self.contractPrivatePostSwapApiV1SwapCancel(self.extend(request, params))
|
5479
5601
|
elif market['future']:
|
5480
|
-
if
|
5602
|
+
if trigger:
|
5481
5603
|
response = self.contractPrivatePostApiV1ContractTriggerCancel(self.extend(request, params))
|
5482
5604
|
elif stopLossTakeProfit:
|
5483
5605
|
response = self.contractPrivatePostApiV1ContractTpslCancel(self.extend(request, params))
|
@@ -5517,7 +5639,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5517
5639
|
:param str[] ids: order ids
|
5518
5640
|
:param str symbol: unified market symbol, default is None
|
5519
5641
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5520
|
-
:param bool [params.
|
5642
|
+
:param bool [params.trigger]: *contract only* if the orders are trigger trigger orders or not
|
5521
5643
|
:param bool [params.stopLossTakeProfit]: *contract only* if the orders are stop-loss or take-profit orders
|
5522
5644
|
:returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
5523
5645
|
"""
|
@@ -5567,7 +5689,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5567
5689
|
request['symbol'] = market['settleId']
|
5568
5690
|
else:
|
5569
5691
|
request['contract_code'] = market['id']
|
5570
|
-
|
5692
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
5571
5693
|
stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
|
5572
5694
|
params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trigger'])
|
5573
5695
|
if market['linear']:
|
@@ -5575,14 +5697,14 @@ class htx(Exchange, ImplicitAPI):
|
|
5575
5697
|
marginMode, params = self.handle_margin_mode_and_params('cancelOrders', params)
|
5576
5698
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
5577
5699
|
if marginMode == 'isolated':
|
5578
|
-
if
|
5700
|
+
if trigger:
|
5579
5701
|
response = self.contractPrivatePostLinearSwapApiV1SwapTriggerCancel(self.extend(request, params))
|
5580
5702
|
elif stopLossTakeProfit:
|
5581
5703
|
response = self.contractPrivatePostLinearSwapApiV1SwapTpslCancel(self.extend(request, params))
|
5582
5704
|
else:
|
5583
5705
|
response = self.contractPrivatePostLinearSwapApiV1SwapCancel(self.extend(request, params))
|
5584
5706
|
elif marginMode == 'cross':
|
5585
|
-
if
|
5707
|
+
if trigger:
|
5586
5708
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossTriggerCancel(self.extend(request, params))
|
5587
5709
|
elif stopLossTakeProfit:
|
5588
5710
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossTpslCancel(self.extend(request, params))
|
@@ -5590,14 +5712,14 @@ class htx(Exchange, ImplicitAPI):
|
|
5590
5712
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossCancel(self.extend(request, params))
|
5591
5713
|
elif market['inverse']:
|
5592
5714
|
if market['swap']:
|
5593
|
-
if
|
5715
|
+
if trigger:
|
5594
5716
|
response = self.contractPrivatePostSwapApiV1SwapTriggerCancel(self.extend(request, params))
|
5595
5717
|
elif stopLossTakeProfit:
|
5596
5718
|
response = self.contractPrivatePostSwapApiV1SwapTpslCancel(self.extend(request, params))
|
5597
5719
|
else:
|
5598
5720
|
response = self.contractPrivatePostSwapApiV1SwapCancel(self.extend(request, params))
|
5599
5721
|
elif market['future']:
|
5600
|
-
if
|
5722
|
+
if trigger:
|
5601
5723
|
response = self.contractPrivatePostApiV1ContractTriggerCancel(self.extend(request, params))
|
5602
5724
|
elif stopLossTakeProfit:
|
5603
5725
|
response = self.contractPrivatePostApiV1ContractTpslCancel(self.extend(request, params))
|
@@ -5718,7 +5840,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5718
5840
|
cancel all open orders
|
5719
5841
|
:param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
5720
5842
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5721
|
-
:param boolean [params.
|
5843
|
+
:param boolean [params.trigger]: *contract only* if the orders are trigger trigger orders or not
|
5722
5844
|
:param boolean [params.stopLossTakeProfit]: *contract only* if the orders are stop-loss or take-profit orders
|
5723
5845
|
:param boolean [params.trailing]: *contract only* set to True if you want to cancel all trailing orders
|
5724
5846
|
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -5770,7 +5892,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5770
5892
|
if market['future']:
|
5771
5893
|
request['symbol'] = market['settleId']
|
5772
5894
|
request['contract_code'] = market['id']
|
5773
|
-
|
5895
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
5774
5896
|
stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
|
5775
5897
|
trailing = self.safe_bool(params, 'trailing', False)
|
5776
5898
|
params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger'])
|
@@ -5779,7 +5901,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5779
5901
|
marginMode, params = self.handle_margin_mode_and_params('cancelAllOrders', params)
|
5780
5902
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
5781
5903
|
if marginMode == 'isolated':
|
5782
|
-
if
|
5904
|
+
if trigger:
|
5783
5905
|
response = self.contractPrivatePostLinearSwapApiV1SwapTriggerCancelall(self.extend(request, params))
|
5784
5906
|
elif stopLossTakeProfit:
|
5785
5907
|
response = self.contractPrivatePostLinearSwapApiV1SwapTpslCancelall(self.extend(request, params))
|
@@ -5788,7 +5910,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5788
5910
|
else:
|
5789
5911
|
response = self.contractPrivatePostLinearSwapApiV1SwapCancelall(self.extend(request, params))
|
5790
5912
|
elif marginMode == 'cross':
|
5791
|
-
if
|
5913
|
+
if trigger:
|
5792
5914
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossTriggerCancelall(self.extend(request, params))
|
5793
5915
|
elif stopLossTakeProfit:
|
5794
5916
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossTpslCancelall(self.extend(request, params))
|
@@ -5798,7 +5920,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5798
5920
|
response = self.contractPrivatePostLinearSwapApiV1SwapCrossCancelall(self.extend(request, params))
|
5799
5921
|
elif market['inverse']:
|
5800
5922
|
if market['swap']:
|
5801
|
-
if
|
5923
|
+
if trigger:
|
5802
5924
|
response = self.contractPrivatePostSwapApiV1SwapTriggerCancelall(self.extend(request, params))
|
5803
5925
|
elif stopLossTakeProfit:
|
5804
5926
|
response = self.contractPrivatePostSwapApiV1SwapTpslCancelall(self.extend(request, params))
|
@@ -5807,7 +5929,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5807
5929
|
else:
|
5808
5930
|
response = self.contractPrivatePostSwapApiV1SwapCancelall(self.extend(request, params))
|
5809
5931
|
elif market['future']:
|
5810
|
-
if
|
5932
|
+
if trigger:
|
5811
5933
|
response = self.contractPrivatePostApiV1ContractTriggerCancelall(self.extend(request, params))
|
5812
5934
|
elif stopLossTakeProfit:
|
5813
5935
|
response = self.contractPrivatePostApiV1ContractTpslCancelall(self.extend(request, params))
|
ccxt/kucoin.py
CHANGED
@@ -576,6 +576,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
576
576
|
'400008': NotSupported,
|
577
577
|
'400100': InsufficientFunds, # {"msg":"account.available.amount","code":"400100"} or {"msg":"Withdrawal amount is below the minimum requirement.","code":"400100"}
|
578
578
|
'400200': InvalidOrder, # {"code":"400200","msg":"Forbidden to place an order"}
|
579
|
+
'400330': InvalidOrder, # {"msg":"Order price can't deviate from NAV by 50%","code":"400330"}
|
579
580
|
'400350': InvalidOrder, # {"code":"400350","msg":"Upper limit for holding: 10,000USDT, you can still buy 10,000USDT worth of coin."}
|
580
581
|
'400370': InvalidOrder, # {"code":"400370","msg":"Max. price: 0.02500000000000000000"}
|
581
582
|
'400400': BadRequest, # Parameter error
|
@@ -927,6 +928,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
927
928
|
'TRUE': 'true',
|
928
929
|
'CS': 'cs',
|
929
930
|
'ORAI': 'orai',
|
931
|
+
'BASE': 'base',
|
930
932
|
# below will be uncommented after consensus
|
931
933
|
# 'BITCOINDIAMON': 'bcd',
|
932
934
|
# 'BITCOINGOLD': 'btg',
|
@@ -1002,6 +1004,74 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1002
1004
|
'spot': 'TRADE',
|
1003
1005
|
},
|
1004
1006
|
},
|
1007
|
+
'features': {
|
1008
|
+
'spot': {
|
1009
|
+
'sandbox': False,
|
1010
|
+
'createOrder': {
|
1011
|
+
'marginMode': True,
|
1012
|
+
'triggerPrice': True,
|
1013
|
+
'triggerPriceType': None,
|
1014
|
+
'triggerDirection': False,
|
1015
|
+
'stopLossPrice': True,
|
1016
|
+
'takeProfitPrice': True,
|
1017
|
+
'attachedStopLossTakeProfit': None, # not supported
|
1018
|
+
'timeInForce': {
|
1019
|
+
'IOC': True,
|
1020
|
+
'FOK': True,
|
1021
|
+
'PO': True,
|
1022
|
+
'GTD': True,
|
1023
|
+
},
|
1024
|
+
'hedged': False,
|
1025
|
+
'trailing': False,
|
1026
|
+
# exchange-supported features
|
1027
|
+
# 'iceberg': True,
|
1028
|
+
# 'selfTradePrevention': True,
|
1029
|
+
# 'twap': False,
|
1030
|
+
# 'oco': False,
|
1031
|
+
},
|
1032
|
+
'createOrders': {
|
1033
|
+
'max': 5,
|
1034
|
+
},
|
1035
|
+
'fetchMyTrades': {
|
1036
|
+
'marginMode': True,
|
1037
|
+
'limit': None,
|
1038
|
+
'daysBack': None,
|
1039
|
+
'untilDays': 7, # per implementation comments
|
1040
|
+
},
|
1041
|
+
'fetchOrder': {
|
1042
|
+
'marginMode': False,
|
1043
|
+
'trigger': True,
|
1044
|
+
'trailing': False,
|
1045
|
+
},
|
1046
|
+
'fetchOpenOrders': {
|
1047
|
+
'marginMode': True,
|
1048
|
+
'limit': 500,
|
1049
|
+
'trigger': True,
|
1050
|
+
'trailing': False,
|
1051
|
+
},
|
1052
|
+
'fetchOrders': None,
|
1053
|
+
'fetchClosedOrders': {
|
1054
|
+
'marginMode': True,
|
1055
|
+
'limit': 500,
|
1056
|
+
'daysBackClosed': None,
|
1057
|
+
'daysBackCanceled': None,
|
1058
|
+
'untilDays': 7,
|
1059
|
+
'trigger': True,
|
1060
|
+
'trailing': False,
|
1061
|
+
},
|
1062
|
+
'fetchOHLCV': {
|
1063
|
+
'limit': 1500,
|
1064
|
+
},
|
1065
|
+
},
|
1066
|
+
'swap': {
|
1067
|
+
'linear': None,
|
1068
|
+
'inverse': None,
|
1069
|
+
},
|
1070
|
+
'future': {
|
1071
|
+
'linear': None,
|
1072
|
+
'inverse': None,
|
1073
|
+
},
|
1074
|
+
},
|
1005
1075
|
})
|
1006
1076
|
|
1007
1077
|
def nonce(self):
|
@@ -2615,7 +2685,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2615
2685
|
self.load_markets()
|
2616
2686
|
lowercaseStatus = status.lower()
|
2617
2687
|
until = self.safe_integer(params, 'until')
|
2618
|
-
|
2688
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger', False)
|
2619
2689
|
hf = None
|
2620
2690
|
hf, params = self.handle_hf_and_params(params)
|
2621
2691
|
if hf and (symbol is None):
|
@@ -2641,7 +2711,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2641
2711
|
request['endAt'] = until
|
2642
2712
|
request['tradeType'] = self.safe_string(self.options['marginModes'], marginMode, 'TRADE')
|
2643
2713
|
response = None
|
2644
|
-
if
|
2714
|
+
if trigger:
|
2645
2715
|
response = self.privateGetStopOrder(self.extend(request, query))
|
2646
2716
|
elif hf:
|
2647
2717
|
if lowercaseStatus == 'active':
|
@@ -3053,6 +3123,10 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3053
3123
|
response = None
|
3054
3124
|
request, params = self.handle_until_option('endAt', request, params)
|
3055
3125
|
if hf:
|
3126
|
+
# does not return trades earlier than 2019-02-18T00:00:00Z
|
3127
|
+
if since is not None:
|
3128
|
+
# only returns trades up to one week after the since param
|
3129
|
+
request['startAt'] = since
|
3056
3130
|
response = self.privateGetHfFills(self.extend(request, params))
|
3057
3131
|
elif method == 'private_get_fills':
|
3058
3132
|
# does not return trades earlier than 2019-02-18T00:00:00Z
|
ccxt/kucoinfutures.py
CHANGED
@@ -370,6 +370,91 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
370
370
|
# 'code': 'BTC',
|
371
371
|
# },
|
372
372
|
},
|
373
|
+
'features': {
|
374
|
+
'spot': None,
|
375
|
+
'forDerivs': {
|
376
|
+
'sandbox': False,
|
377
|
+
'createOrder': {
|
378
|
+
'marginMode': True,
|
379
|
+
'triggerPrice': True,
|
380
|
+
'triggerPriceType': {
|
381
|
+
'last': True,
|
382
|
+
'mark': True,
|
383
|
+
'index': True,
|
384
|
+
},
|
385
|
+
'triggerDirection': True,
|
386
|
+
'stopLossPrice': True,
|
387
|
+
'takeProfitPrice': True,
|
388
|
+
'attachedStopLossTakeProfit': {
|
389
|
+
'triggerPrice': None,
|
390
|
+
'triggerPriceType': None,
|
391
|
+
'limitPrice': True,
|
392
|
+
},
|
393
|
+
'timeInForce': {
|
394
|
+
'IOC': True,
|
395
|
+
'FOK': False,
|
396
|
+
'PO': True,
|
397
|
+
'GTD': False,
|
398
|
+
},
|
399
|
+
'hedged': False,
|
400
|
+
'trailing': False,
|
401
|
+
# exchange-supported features
|
402
|
+
# 'iceberg': True,
|
403
|
+
# 'selfTradePrevention': True,
|
404
|
+
# 'twap': False,
|
405
|
+
# 'oco': False,
|
406
|
+
},
|
407
|
+
'createOrders': {
|
408
|
+
'max': 20,
|
409
|
+
},
|
410
|
+
'fetchMyTrades': {
|
411
|
+
'marginMode': True,
|
412
|
+
'limit': 1000,
|
413
|
+
'daysBack': None,
|
414
|
+
'untilDays': 7,
|
415
|
+
},
|
416
|
+
'fetchOrder': {
|
417
|
+
'marginMode': False,
|
418
|
+
'trigger': False,
|
419
|
+
'trailing': False,
|
420
|
+
},
|
421
|
+
'fetchOpenOrders': {
|
422
|
+
'marginMode': False,
|
423
|
+
'limit': 1000,
|
424
|
+
'trigger': True,
|
425
|
+
'trailing': False,
|
426
|
+
},
|
427
|
+
'fetchOrders': None,
|
428
|
+
'fetchClosedOrders': {
|
429
|
+
'marginMode': False,
|
430
|
+
'limit': 1000,
|
431
|
+
'daysBackClosed': None,
|
432
|
+
'daysBackCanceled': None,
|
433
|
+
'untilDays': None,
|
434
|
+
'trigger': True,
|
435
|
+
'trailing': False,
|
436
|
+
},
|
437
|
+
'fetchOHLCV': {
|
438
|
+
'limit': 500,
|
439
|
+
},
|
440
|
+
},
|
441
|
+
'swap': {
|
442
|
+
'linear': {
|
443
|
+
'extends': 'forDerivs',
|
444
|
+
},
|
445
|
+
'inverse': {
|
446
|
+
'extends': 'forDerivs',
|
447
|
+
},
|
448
|
+
},
|
449
|
+
'future': {
|
450
|
+
'linear': {
|
451
|
+
'extends': 'forDerivs',
|
452
|
+
},
|
453
|
+
'inverse': {
|
454
|
+
'extends': 'forDerivs',
|
455
|
+
},
|
456
|
+
},
|
457
|
+
},
|
373
458
|
})
|
374
459
|
|
375
460
|
def fetch_status(self, params={}):
|
@@ -1698,10 +1783,10 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
1698
1783
|
request: dict = {}
|
1699
1784
|
if symbol is not None:
|
1700
1785
|
request['symbol'] = self.market_id(symbol)
|
1701
|
-
|
1786
|
+
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
1702
1787
|
params = self.omit(params, ['stop', 'trigger'])
|
1703
1788
|
response = None
|
1704
|
-
if
|
1789
|
+
if trigger:
|
1705
1790
|
response = self.futuresPrivateDeleteStopOrders(self.extend(request, params))
|
1706
1791
|
else:
|
1707
1792
|
response = self.futuresPrivateDeleteOrders(self.extend(request, params))
|
@@ -1882,7 +1967,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
1882
1967
|
paginate, params = self.handle_option_and_params(params, 'fetchOrdersByStatus', 'paginate')
|
1883
1968
|
if paginate:
|
1884
1969
|
return self.fetch_paginated_call_dynamic('fetchOrdersByStatus', symbol, since, limit, params)
|
1885
|
-
|
1970
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
1886
1971
|
until = self.safe_integer(params, 'until')
|
1887
1972
|
params = self.omit(params, ['stop', 'until', 'trigger'])
|
1888
1973
|
if status == 'closed':
|
@@ -1890,7 +1975,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
1890
1975
|
elif status == 'open':
|
1891
1976
|
status = 'active'
|
1892
1977
|
request: dict = {}
|
1893
|
-
if not
|
1978
|
+
if not trigger:
|
1894
1979
|
request['status'] = status
|
1895
1980
|
elif status != 'active':
|
1896
1981
|
raise BadRequest(self.id + ' fetchOrdersByStatus() can only fetch untriggered stop orders')
|
@@ -1903,7 +1988,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
1903
1988
|
if until is not None:
|
1904
1989
|
request['endAt'] = until
|
1905
1990
|
response = None
|
1906
|
-
if
|
1991
|
+
if trigger:
|
1907
1992
|
response = self.futuresPrivateGetStopOrders(self.extend(request, params))
|
1908
1993
|
else:
|
1909
1994
|
response = self.futuresPrivateGetOrders(self.extend(request, params))
|
@@ -2510,6 +2595,8 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
2510
2595
|
request['symbol'] = market['id']
|
2511
2596
|
if since is not None:
|
2512
2597
|
request['startAt'] = since
|
2598
|
+
if limit is not None:
|
2599
|
+
request['pageSize'] = min(1000, limit)
|
2513
2600
|
request, params = self.handle_until_option('endAt', request, params)
|
2514
2601
|
response = self.futuresPrivateGetFills(self.extend(request, params))
|
2515
2602
|
#
|