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/async_support/htx.py
CHANGED
@@ -1251,6 +1251,128 @@ class htx(Exchange, ImplicitAPI):
|
|
1251
1251
|
'BIFI': 'BITCOINFILE', # conflict with Beefy.Finance https://github.com/ccxt/ccxt/issues/8706
|
1252
1252
|
'FUD': 'FTX Users Debt',
|
1253
1253
|
},
|
1254
|
+
'features': {
|
1255
|
+
'spot': {
|
1256
|
+
'sandbox': True,
|
1257
|
+
'createOrder': {
|
1258
|
+
'marginMode': True,
|
1259
|
+
'triggerPrice': True,
|
1260
|
+
'triggerDirection': True,
|
1261
|
+
'triggerPriceType': None,
|
1262
|
+
'stopLossPrice': False, # todo: add support by triggerprice
|
1263
|
+
'takeProfitPrice': False,
|
1264
|
+
'attachedStopLossTakeProfit': None,
|
1265
|
+
'timeInForce': {
|
1266
|
+
'IOC': True,
|
1267
|
+
'FOK': True,
|
1268
|
+
'PO': True,
|
1269
|
+
'GTD': False,
|
1270
|
+
},
|
1271
|
+
'hedged': False,
|
1272
|
+
'trailing': False,
|
1273
|
+
# exchange-specific features
|
1274
|
+
'iceberg': False,
|
1275
|
+
'selfTradePrevention': True,
|
1276
|
+
},
|
1277
|
+
'createOrders': {
|
1278
|
+
'max': 10,
|
1279
|
+
},
|
1280
|
+
'fetchMyTrades': {
|
1281
|
+
'marginMode': False,
|
1282
|
+
'limit': 500,
|
1283
|
+
'daysBack': 120,
|
1284
|
+
'untilDays': 2,
|
1285
|
+
},
|
1286
|
+
'fetchOrder': {
|
1287
|
+
'marginMode': False,
|
1288
|
+
'trigger': False,
|
1289
|
+
'trailing': False,
|
1290
|
+
},
|
1291
|
+
'fetchOpenOrders': {
|
1292
|
+
'marginMode': False,
|
1293
|
+
'trigger': True,
|
1294
|
+
'trailing': False,
|
1295
|
+
'limit': 500,
|
1296
|
+
},
|
1297
|
+
'fetchOrders': {
|
1298
|
+
'marginMode': False,
|
1299
|
+
'trigger': True,
|
1300
|
+
'trailing': False,
|
1301
|
+
'limit': 500,
|
1302
|
+
'untilDays': 2,
|
1303
|
+
'daysBack': 180,
|
1304
|
+
},
|
1305
|
+
'fetchClosedOrders': {
|
1306
|
+
'marginMode': False,
|
1307
|
+
'trigger': True,
|
1308
|
+
'trailing': False,
|
1309
|
+
'untilDays': 2,
|
1310
|
+
'limit': 500,
|
1311
|
+
'daysBackClosed': 180,
|
1312
|
+
'daysBackCanceled': 1 / 12,
|
1313
|
+
},
|
1314
|
+
'fetchOHLCV': {
|
1315
|
+
'limit': 1000, # 2000 for non-historical
|
1316
|
+
},
|
1317
|
+
},
|
1318
|
+
'forDerivatives': {
|
1319
|
+
'extends': 'spot',
|
1320
|
+
'createOrder': {
|
1321
|
+
'stopLossPrice': True,
|
1322
|
+
'takeProfitPrice': True,
|
1323
|
+
'trailing': True,
|
1324
|
+
'hedged': True,
|
1325
|
+
# 'leverage': True, # todo
|
1326
|
+
},
|
1327
|
+
'createOrders': {
|
1328
|
+
'max': 25,
|
1329
|
+
},
|
1330
|
+
'fetchOrder': {
|
1331
|
+
'marginMode': True,
|
1332
|
+
},
|
1333
|
+
'fetchOpenOrders': {
|
1334
|
+
'marginMode': True,
|
1335
|
+
'trigger': False,
|
1336
|
+
'trailing': False,
|
1337
|
+
'limit': 50,
|
1338
|
+
},
|
1339
|
+
'fetchOrders': {
|
1340
|
+
'marginMode': True,
|
1341
|
+
'trigger': False,
|
1342
|
+
'trailing': False,
|
1343
|
+
'limit': 50,
|
1344
|
+
'daysBack': 90,
|
1345
|
+
},
|
1346
|
+
'fetchClosedOrders': {
|
1347
|
+
'marginMode': True,
|
1348
|
+
'trigger': False,
|
1349
|
+
'trailing': False,
|
1350
|
+
'untilDays': 2,
|
1351
|
+
'limit': 50,
|
1352
|
+
'daysBackClosed': 90,
|
1353
|
+
'daysBackCanceled': 1 / 12,
|
1354
|
+
},
|
1355
|
+
'fetchOHLCV': {
|
1356
|
+
'limit': 2000,
|
1357
|
+
},
|
1358
|
+
},
|
1359
|
+
'swap': {
|
1360
|
+
'linear': {
|
1361
|
+
'extends': 'forDerivatives',
|
1362
|
+
},
|
1363
|
+
'inverse': {
|
1364
|
+
'extends': 'forDerivatives',
|
1365
|
+
},
|
1366
|
+
},
|
1367
|
+
'future': {
|
1368
|
+
'linear': {
|
1369
|
+
'extends': 'forDerivatives',
|
1370
|
+
},
|
1371
|
+
'inverse': {
|
1372
|
+
'extends': 'forDerivatives',
|
1373
|
+
},
|
1374
|
+
},
|
1375
|
+
},
|
1254
1376
|
})
|
1255
1377
|
|
1256
1378
|
async def fetch_status(self, params={}):
|
@@ -3865,11 +3987,11 @@ class htx(Exchange, ImplicitAPI):
|
|
3865
3987
|
'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
|
3866
3988
|
}
|
3867
3989
|
response = None
|
3868
|
-
|
3990
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
3869
3991
|
stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
|
3870
3992
|
trailing = self.safe_bool(params, 'trailing', False)
|
3871
3993
|
params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger'])
|
3872
|
-
if
|
3994
|
+
if trigger or stopLossTakeProfit or trailing:
|
3873
3995
|
if limit is not None:
|
3874
3996
|
request['page_size'] = limit
|
3875
3997
|
request['contract_code'] = market['id']
|
@@ -3886,7 +4008,7 @@ class htx(Exchange, ImplicitAPI):
|
|
3886
4008
|
marginMode, params = self.handle_margin_mode_and_params('fetchContractOrders', params)
|
3887
4009
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
3888
4010
|
if marginMode == 'isolated':
|
3889
|
-
if
|
4011
|
+
if trigger:
|
3890
4012
|
response = await self.contractPrivatePostLinearSwapApiV1SwapTriggerHisorders(self.extend(request, params))
|
3891
4013
|
elif stopLossTakeProfit:
|
3892
4014
|
response = await self.contractPrivatePostLinearSwapApiV1SwapTpslHisorders(self.extend(request, params))
|
@@ -3895,7 +4017,7 @@ class htx(Exchange, ImplicitAPI):
|
|
3895
4017
|
else:
|
3896
4018
|
response = await self.contractPrivatePostLinearSwapApiV3SwapHisorders(self.extend(request, params))
|
3897
4019
|
elif marginMode == 'cross':
|
3898
|
-
if
|
4020
|
+
if trigger:
|
3899
4021
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossTriggerHisorders(self.extend(request, params))
|
3900
4022
|
elif stopLossTakeProfit:
|
3901
4023
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossTpslHisorders(self.extend(request, params))
|
@@ -3905,7 +4027,7 @@ class htx(Exchange, ImplicitAPI):
|
|
3905
4027
|
response = await self.contractPrivatePostLinearSwapApiV3SwapCrossHisorders(self.extend(request, params))
|
3906
4028
|
elif market['inverse']:
|
3907
4029
|
if market['swap']:
|
3908
|
-
if
|
4030
|
+
if trigger:
|
3909
4031
|
response = await self.contractPrivatePostSwapApiV1SwapTriggerHisorders(self.extend(request, params))
|
3910
4032
|
elif stopLossTakeProfit:
|
3911
4033
|
response = await self.contractPrivatePostSwapApiV1SwapTpslHisorders(self.extend(request, params))
|
@@ -3915,7 +4037,7 @@ class htx(Exchange, ImplicitAPI):
|
|
3915
4037
|
response = await self.contractPrivatePostSwapApiV3SwapHisorders(self.extend(request, params))
|
3916
4038
|
elif market['future']:
|
3917
4039
|
request['symbol'] = market['settleId']
|
3918
|
-
if
|
4040
|
+
if trigger:
|
3919
4041
|
response = await self.contractPrivatePostApiV1ContractTriggerHisorders(self.extend(request, params))
|
3920
4042
|
elif stopLossTakeProfit:
|
3921
4043
|
response = await self.contractPrivatePostApiV1ContractTpslHisorders(self.extend(request, params))
|
@@ -4091,7 +4213,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4091
4213
|
:param int [since]: the earliest time in ms to fetch orders for
|
4092
4214
|
:param int [limit]: the maximum number of order structures to retrieve
|
4093
4215
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4094
|
-
:param bool [params.
|
4216
|
+
:param bool [params.trigger]: *contract only* if the orders are trigger trigger orders or not
|
4095
4217
|
:param bool [params.stopLossTakeProfit]: *contract only* if the orders are stop-loss or take-profit orders
|
4096
4218
|
:param int [params.until]: the latest time in ms to fetch entries for
|
4097
4219
|
:param boolean [params.trailing]: *contract only* set to True if you want to fetch trailing stop orders
|
@@ -4157,7 +4279,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4157
4279
|
:param int [since]: the earliest time in ms to fetch open orders for
|
4158
4280
|
:param int [limit]: the maximum number of open order structures to retrieve
|
4159
4281
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4160
|
-
:param bool [params.
|
4282
|
+
:param bool [params.trigger]: *contract only* if the orders are trigger trigger orders or not
|
4161
4283
|
:param bool [params.stopLossTakeProfit]: *contract only* if the orders are stop-loss or take-profit orders
|
4162
4284
|
:param boolean [params.trailing]: *contract only* set to True if you want to fetch trailing stop orders
|
4163
4285
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -4195,7 +4317,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4195
4317
|
if limit is not None:
|
4196
4318
|
request['page_size'] = limit
|
4197
4319
|
request['contract_code'] = market['id']
|
4198
|
-
|
4320
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
4199
4321
|
stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
|
4200
4322
|
trailing = self.safe_bool(params, 'trailing', False)
|
4201
4323
|
params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger'])
|
@@ -4204,7 +4326,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4204
4326
|
marginMode, params = self.handle_margin_mode_and_params('fetchOpenOrders', params)
|
4205
4327
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
4206
4328
|
if marginMode == 'isolated':
|
4207
|
-
if
|
4329
|
+
if trigger:
|
4208
4330
|
response = await self.contractPrivatePostLinearSwapApiV1SwapTriggerOpenorders(self.extend(request, params))
|
4209
4331
|
elif stopLossTakeProfit:
|
4210
4332
|
response = await self.contractPrivatePostLinearSwapApiV1SwapTpslOpenorders(self.extend(request, params))
|
@@ -4213,7 +4335,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4213
4335
|
else:
|
4214
4336
|
response = await self.contractPrivatePostLinearSwapApiV1SwapOpenorders(self.extend(request, params))
|
4215
4337
|
elif marginMode == 'cross':
|
4216
|
-
if
|
4338
|
+
if trigger:
|
4217
4339
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossTriggerOpenorders(self.extend(request, params))
|
4218
4340
|
elif stopLossTakeProfit:
|
4219
4341
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossTpslOpenorders(self.extend(request, params))
|
@@ -4223,7 +4345,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4223
4345
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossOpenorders(self.extend(request, params))
|
4224
4346
|
elif market['inverse']:
|
4225
4347
|
if market['swap']:
|
4226
|
-
if
|
4348
|
+
if trigger:
|
4227
4349
|
response = await self.contractPrivatePostSwapApiV1SwapTriggerOpenorders(self.extend(request, params))
|
4228
4350
|
elif stopLossTakeProfit:
|
4229
4351
|
response = await self.contractPrivatePostSwapApiV1SwapTpslOpenorders(self.extend(request, params))
|
@@ -4233,7 +4355,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4233
4355
|
response = await self.contractPrivatePostSwapApiV1SwapOpenorders(self.extend(request, params))
|
4234
4356
|
elif market['future']:
|
4235
4357
|
request['symbol'] = market['settleId']
|
4236
|
-
if
|
4358
|
+
if trigger:
|
4237
4359
|
response = await self.contractPrivatePostApiV1ContractTriggerOpenorders(self.extend(request, params))
|
4238
4360
|
elif stopLossTakeProfit:
|
4239
4361
|
response = await self.contractPrivatePostApiV1ContractTpslOpenorders(self.extend(request, params))
|
@@ -4959,7 +5081,7 @@ class htx(Exchange, ImplicitAPI):
|
|
4959
5081
|
if triggerPrice is None:
|
4960
5082
|
stopOrderTypes = self.safe_value(options, 'stopOrderTypes', {})
|
4961
5083
|
if orderType in stopOrderTypes:
|
4962
|
-
raise ArgumentsRequired(self.id + ' createOrder() requires a triggerPrice for a
|
5084
|
+
raise ArgumentsRequired(self.id + ' createOrder() requires a triggerPrice for a trigger order')
|
4963
5085
|
else:
|
4964
5086
|
defaultOperator = 'lte' if (side == 'sell') else 'gte'
|
4965
5087
|
stopOperator = self.safe_string(params, 'operator', defaultOperator)
|
@@ -5395,7 +5517,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5395
5517
|
:param str id: order id
|
5396
5518
|
:param str symbol: unified symbol of the market the order was made in
|
5397
5519
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5398
|
-
:param boolean [params.
|
5520
|
+
:param boolean [params.trigger]: *contract only* if the order is a trigger trigger order or not
|
5399
5521
|
:param boolean [params.stopLossTakeProfit]: *contract only* if the order is a stop-loss or take-profit order
|
5400
5522
|
:param boolean [params.trailing]: *contract only* set to True if you want to cancel a trailing order
|
5401
5523
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -5441,7 +5563,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5441
5563
|
request['symbol'] = market['settleId']
|
5442
5564
|
else:
|
5443
5565
|
request['contract_code'] = market['id']
|
5444
|
-
|
5566
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
5445
5567
|
stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
|
5446
5568
|
trailing = self.safe_bool(params, 'trailing', False)
|
5447
5569
|
params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger'])
|
@@ -5450,7 +5572,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5450
5572
|
marginMode, params = self.handle_margin_mode_and_params('cancelOrder', params)
|
5451
5573
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
5452
5574
|
if marginMode == 'isolated':
|
5453
|
-
if
|
5575
|
+
if trigger:
|
5454
5576
|
response = await self.contractPrivatePostLinearSwapApiV1SwapTriggerCancel(self.extend(request, params))
|
5455
5577
|
elif stopLossTakeProfit:
|
5456
5578
|
response = await self.contractPrivatePostLinearSwapApiV1SwapTpslCancel(self.extend(request, params))
|
@@ -5459,7 +5581,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5459
5581
|
else:
|
5460
5582
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCancel(self.extend(request, params))
|
5461
5583
|
elif marginMode == 'cross':
|
5462
|
-
if
|
5584
|
+
if trigger:
|
5463
5585
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossTriggerCancel(self.extend(request, params))
|
5464
5586
|
elif stopLossTakeProfit:
|
5465
5587
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossTpslCancel(self.extend(request, params))
|
@@ -5469,7 +5591,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5469
5591
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossCancel(self.extend(request, params))
|
5470
5592
|
elif market['inverse']:
|
5471
5593
|
if market['swap']:
|
5472
|
-
if
|
5594
|
+
if trigger:
|
5473
5595
|
response = await self.contractPrivatePostSwapApiV1SwapTriggerCancel(self.extend(request, params))
|
5474
5596
|
elif stopLossTakeProfit:
|
5475
5597
|
response = await self.contractPrivatePostSwapApiV1SwapTpslCancel(self.extend(request, params))
|
@@ -5478,7 +5600,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5478
5600
|
else:
|
5479
5601
|
response = await self.contractPrivatePostSwapApiV1SwapCancel(self.extend(request, params))
|
5480
5602
|
elif market['future']:
|
5481
|
-
if
|
5603
|
+
if trigger:
|
5482
5604
|
response = await self.contractPrivatePostApiV1ContractTriggerCancel(self.extend(request, params))
|
5483
5605
|
elif stopLossTakeProfit:
|
5484
5606
|
response = await self.contractPrivatePostApiV1ContractTpslCancel(self.extend(request, params))
|
@@ -5518,7 +5640,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5518
5640
|
:param str[] ids: order ids
|
5519
5641
|
:param str symbol: unified market symbol, default is None
|
5520
5642
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5521
|
-
:param bool [params.
|
5643
|
+
:param bool [params.trigger]: *contract only* if the orders are trigger trigger orders or not
|
5522
5644
|
:param bool [params.stopLossTakeProfit]: *contract only* if the orders are stop-loss or take-profit orders
|
5523
5645
|
:returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
5524
5646
|
"""
|
@@ -5568,7 +5690,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5568
5690
|
request['symbol'] = market['settleId']
|
5569
5691
|
else:
|
5570
5692
|
request['contract_code'] = market['id']
|
5571
|
-
|
5693
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
5572
5694
|
stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
|
5573
5695
|
params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trigger'])
|
5574
5696
|
if market['linear']:
|
@@ -5576,14 +5698,14 @@ class htx(Exchange, ImplicitAPI):
|
|
5576
5698
|
marginMode, params = self.handle_margin_mode_and_params('cancelOrders', params)
|
5577
5699
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
5578
5700
|
if marginMode == 'isolated':
|
5579
|
-
if
|
5701
|
+
if trigger:
|
5580
5702
|
response = await self.contractPrivatePostLinearSwapApiV1SwapTriggerCancel(self.extend(request, params))
|
5581
5703
|
elif stopLossTakeProfit:
|
5582
5704
|
response = await self.contractPrivatePostLinearSwapApiV1SwapTpslCancel(self.extend(request, params))
|
5583
5705
|
else:
|
5584
5706
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCancel(self.extend(request, params))
|
5585
5707
|
elif marginMode == 'cross':
|
5586
|
-
if
|
5708
|
+
if trigger:
|
5587
5709
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossTriggerCancel(self.extend(request, params))
|
5588
5710
|
elif stopLossTakeProfit:
|
5589
5711
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossTpslCancel(self.extend(request, params))
|
@@ -5591,14 +5713,14 @@ class htx(Exchange, ImplicitAPI):
|
|
5591
5713
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossCancel(self.extend(request, params))
|
5592
5714
|
elif market['inverse']:
|
5593
5715
|
if market['swap']:
|
5594
|
-
if
|
5716
|
+
if trigger:
|
5595
5717
|
response = await self.contractPrivatePostSwapApiV1SwapTriggerCancel(self.extend(request, params))
|
5596
5718
|
elif stopLossTakeProfit:
|
5597
5719
|
response = await self.contractPrivatePostSwapApiV1SwapTpslCancel(self.extend(request, params))
|
5598
5720
|
else:
|
5599
5721
|
response = await self.contractPrivatePostSwapApiV1SwapCancel(self.extend(request, params))
|
5600
5722
|
elif market['future']:
|
5601
|
-
if
|
5723
|
+
if trigger:
|
5602
5724
|
response = await self.contractPrivatePostApiV1ContractTriggerCancel(self.extend(request, params))
|
5603
5725
|
elif stopLossTakeProfit:
|
5604
5726
|
response = await self.contractPrivatePostApiV1ContractTpslCancel(self.extend(request, params))
|
@@ -5719,7 +5841,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5719
5841
|
cancel all open orders
|
5720
5842
|
:param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
5721
5843
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5722
|
-
:param boolean [params.
|
5844
|
+
:param boolean [params.trigger]: *contract only* if the orders are trigger trigger orders or not
|
5723
5845
|
:param boolean [params.stopLossTakeProfit]: *contract only* if the orders are stop-loss or take-profit orders
|
5724
5846
|
:param boolean [params.trailing]: *contract only* set to True if you want to cancel all trailing orders
|
5725
5847
|
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -5771,7 +5893,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5771
5893
|
if market['future']:
|
5772
5894
|
request['symbol'] = market['settleId']
|
5773
5895
|
request['contract_code'] = market['id']
|
5774
|
-
|
5896
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
5775
5897
|
stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
|
5776
5898
|
trailing = self.safe_bool(params, 'trailing', False)
|
5777
5899
|
params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger'])
|
@@ -5780,7 +5902,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5780
5902
|
marginMode, params = self.handle_margin_mode_and_params('cancelAllOrders', params)
|
5781
5903
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
5782
5904
|
if marginMode == 'isolated':
|
5783
|
-
if
|
5905
|
+
if trigger:
|
5784
5906
|
response = await self.contractPrivatePostLinearSwapApiV1SwapTriggerCancelall(self.extend(request, params))
|
5785
5907
|
elif stopLossTakeProfit:
|
5786
5908
|
response = await self.contractPrivatePostLinearSwapApiV1SwapTpslCancelall(self.extend(request, params))
|
@@ -5789,7 +5911,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5789
5911
|
else:
|
5790
5912
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCancelall(self.extend(request, params))
|
5791
5913
|
elif marginMode == 'cross':
|
5792
|
-
if
|
5914
|
+
if trigger:
|
5793
5915
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossTriggerCancelall(self.extend(request, params))
|
5794
5916
|
elif stopLossTakeProfit:
|
5795
5917
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossTpslCancelall(self.extend(request, params))
|
@@ -5799,7 +5921,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5799
5921
|
response = await self.contractPrivatePostLinearSwapApiV1SwapCrossCancelall(self.extend(request, params))
|
5800
5922
|
elif market['inverse']:
|
5801
5923
|
if market['swap']:
|
5802
|
-
if
|
5924
|
+
if trigger:
|
5803
5925
|
response = await self.contractPrivatePostSwapApiV1SwapTriggerCancelall(self.extend(request, params))
|
5804
5926
|
elif stopLossTakeProfit:
|
5805
5927
|
response = await self.contractPrivatePostSwapApiV1SwapTpslCancelall(self.extend(request, params))
|
@@ -5808,7 +5930,7 @@ class htx(Exchange, ImplicitAPI):
|
|
5808
5930
|
else:
|
5809
5931
|
response = await self.contractPrivatePostSwapApiV1SwapCancelall(self.extend(request, params))
|
5810
5932
|
elif market['future']:
|
5811
|
-
if
|
5933
|
+
if trigger:
|
5812
5934
|
response = await self.contractPrivatePostApiV1ContractTriggerCancelall(self.extend(request, params))
|
5813
5935
|
elif stopLossTakeProfit:
|
5814
5936
|
response = await self.contractPrivatePostApiV1ContractTpslCancelall(self.extend(request, params))
|
ccxt/async_support/kucoin.py
CHANGED
@@ -577,6 +577,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
577
577
|
'400008': NotSupported,
|
578
578
|
'400100': InsufficientFunds, # {"msg":"account.available.amount","code":"400100"} or {"msg":"Withdrawal amount is below the minimum requirement.","code":"400100"}
|
579
579
|
'400200': InvalidOrder, # {"code":"400200","msg":"Forbidden to place an order"}
|
580
|
+
'400330': InvalidOrder, # {"msg":"Order price can't deviate from NAV by 50%","code":"400330"}
|
580
581
|
'400350': InvalidOrder, # {"code":"400350","msg":"Upper limit for holding: 10,000USDT, you can still buy 10,000USDT worth of coin."}
|
581
582
|
'400370': InvalidOrder, # {"code":"400370","msg":"Max. price: 0.02500000000000000000"}
|
582
583
|
'400400': BadRequest, # Parameter error
|
@@ -928,6 +929,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
928
929
|
'TRUE': 'true',
|
929
930
|
'CS': 'cs',
|
930
931
|
'ORAI': 'orai',
|
932
|
+
'BASE': 'base',
|
931
933
|
# below will be uncommented after consensus
|
932
934
|
# 'BITCOINDIAMON': 'bcd',
|
933
935
|
# 'BITCOINGOLD': 'btg',
|
@@ -1003,6 +1005,74 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1003
1005
|
'spot': 'TRADE',
|
1004
1006
|
},
|
1005
1007
|
},
|
1008
|
+
'features': {
|
1009
|
+
'spot': {
|
1010
|
+
'sandbox': False,
|
1011
|
+
'createOrder': {
|
1012
|
+
'marginMode': True,
|
1013
|
+
'triggerPrice': True,
|
1014
|
+
'triggerPriceType': None,
|
1015
|
+
'triggerDirection': False,
|
1016
|
+
'stopLossPrice': True,
|
1017
|
+
'takeProfitPrice': True,
|
1018
|
+
'attachedStopLossTakeProfit': None, # not supported
|
1019
|
+
'timeInForce': {
|
1020
|
+
'IOC': True,
|
1021
|
+
'FOK': True,
|
1022
|
+
'PO': True,
|
1023
|
+
'GTD': True,
|
1024
|
+
},
|
1025
|
+
'hedged': False,
|
1026
|
+
'trailing': False,
|
1027
|
+
# exchange-supported features
|
1028
|
+
# 'iceberg': True,
|
1029
|
+
# 'selfTradePrevention': True,
|
1030
|
+
# 'twap': False,
|
1031
|
+
# 'oco': False,
|
1032
|
+
},
|
1033
|
+
'createOrders': {
|
1034
|
+
'max': 5,
|
1035
|
+
},
|
1036
|
+
'fetchMyTrades': {
|
1037
|
+
'marginMode': True,
|
1038
|
+
'limit': None,
|
1039
|
+
'daysBack': None,
|
1040
|
+
'untilDays': 7, # per implementation comments
|
1041
|
+
},
|
1042
|
+
'fetchOrder': {
|
1043
|
+
'marginMode': False,
|
1044
|
+
'trigger': True,
|
1045
|
+
'trailing': False,
|
1046
|
+
},
|
1047
|
+
'fetchOpenOrders': {
|
1048
|
+
'marginMode': True,
|
1049
|
+
'limit': 500,
|
1050
|
+
'trigger': True,
|
1051
|
+
'trailing': False,
|
1052
|
+
},
|
1053
|
+
'fetchOrders': None,
|
1054
|
+
'fetchClosedOrders': {
|
1055
|
+
'marginMode': True,
|
1056
|
+
'limit': 500,
|
1057
|
+
'daysBackClosed': None,
|
1058
|
+
'daysBackCanceled': None,
|
1059
|
+
'untilDays': 7,
|
1060
|
+
'trigger': True,
|
1061
|
+
'trailing': False,
|
1062
|
+
},
|
1063
|
+
'fetchOHLCV': {
|
1064
|
+
'limit': 1500,
|
1065
|
+
},
|
1066
|
+
},
|
1067
|
+
'swap': {
|
1068
|
+
'linear': None,
|
1069
|
+
'inverse': None,
|
1070
|
+
},
|
1071
|
+
'future': {
|
1072
|
+
'linear': None,
|
1073
|
+
'inverse': None,
|
1074
|
+
},
|
1075
|
+
},
|
1006
1076
|
})
|
1007
1077
|
|
1008
1078
|
def nonce(self):
|
@@ -2616,7 +2686,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2616
2686
|
await self.load_markets()
|
2617
2687
|
lowercaseStatus = status.lower()
|
2618
2688
|
until = self.safe_integer(params, 'until')
|
2619
|
-
|
2689
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger', False)
|
2620
2690
|
hf = None
|
2621
2691
|
hf, params = self.handle_hf_and_params(params)
|
2622
2692
|
if hf and (symbol is None):
|
@@ -2642,7 +2712,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2642
2712
|
request['endAt'] = until
|
2643
2713
|
request['tradeType'] = self.safe_string(self.options['marginModes'], marginMode, 'TRADE')
|
2644
2714
|
response = None
|
2645
|
-
if
|
2715
|
+
if trigger:
|
2646
2716
|
response = await self.privateGetStopOrder(self.extend(request, query))
|
2647
2717
|
elif hf:
|
2648
2718
|
if lowercaseStatus == 'active':
|
@@ -3054,6 +3124,10 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3054
3124
|
response = None
|
3055
3125
|
request, params = self.handle_until_option('endAt', request, params)
|
3056
3126
|
if hf:
|
3127
|
+
# does not return trades earlier than 2019-02-18T00:00:00Z
|
3128
|
+
if since is not None:
|
3129
|
+
# only returns trades up to one week after the since param
|
3130
|
+
request['startAt'] = since
|
3057
3131
|
response = await self.privateGetHfFills(self.extend(request, params))
|
3058
3132
|
elif method == 'private_get_fills':
|
3059
3133
|
# does not return trades earlier than 2019-02-18T00:00:00Z
|
@@ -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
|
async 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 = await self.futuresPrivateDeleteStopOrders(self.extend(request, params))
|
1706
1791
|
else:
|
1707
1792
|
response = await 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 await 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 = await self.futuresPrivateGetStopOrders(self.extend(request, params))
|
1908
1993
|
else:
|
1909
1994
|
response = await 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 = await self.futuresPrivateGetFills(self.extend(request, params))
|
2515
2602
|
#
|