ccxt 4.4.95__py2.py3-none-any.whl → 4.4.97__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 +3 -1
- ccxt/abstract/binance.py +3 -0
- ccxt/abstract/binancecoinm.py +3 -0
- ccxt/abstract/binanceus.py +3 -0
- ccxt/abstract/binanceusdm.py +3 -0
- ccxt/abstract/foxbit.py +26 -0
- ccxt/abstract/hyperliquid.py +1 -1
- ccxt/abstract/phemex.py +1 -0
- ccxt/apex.py +3 -3
- ccxt/ascendex.py +2 -2
- ccxt/async_support/__init__.py +3 -1
- ccxt/async_support/apex.py +3 -3
- ccxt/async_support/ascendex.py +2 -2
- ccxt/async_support/base/exchange.py +10 -5
- ccxt/async_support/base/ws/future.py +5 -3
- ccxt/async_support/binance.py +90 -34
- ccxt/async_support/binancecoinm.py +5 -1
- ccxt/async_support/binanceus.py +3 -1
- ccxt/async_support/binanceusdm.py +3 -1
- ccxt/async_support/bingx.py +1 -1
- ccxt/async_support/bitget.py +30 -143
- ccxt/async_support/bitmart.py +2 -2
- ccxt/async_support/bitrue.py +13 -8
- ccxt/async_support/bybit.py +14 -5
- ccxt/async_support/coinbaseexchange.py +4 -2
- ccxt/async_support/coinbaseinternational.py +2 -2
- ccxt/async_support/coinspot.py +36 -1
- ccxt/async_support/cryptocom.py +78 -3
- ccxt/async_support/cryptomus.py +41 -1
- ccxt/async_support/defx.py +1 -1
- ccxt/async_support/derive.py +1 -1
- ccxt/async_support/ellipx.py +40 -0
- ccxt/async_support/exmo.py +1 -1
- ccxt/async_support/foxbit.py +1935 -0
- ccxt/async_support/gate.py +1 -2
- ccxt/async_support/hashkey.py +39 -0
- ccxt/async_support/hyperliquid.py +42 -27
- ccxt/async_support/independentreserve.py +35 -0
- ccxt/async_support/indodax.py +34 -0
- ccxt/async_support/kucoin.py +3 -2
- ccxt/async_support/kucoinfutures.py +3 -2
- ccxt/async_support/latoken.py +42 -0
- ccxt/async_support/luno.py +36 -0
- ccxt/async_support/mercado.py +34 -0
- ccxt/async_support/mexc.py +31 -32
- ccxt/async_support/modetrade.py +3 -3
- ccxt/async_support/okcoin.py +1 -1
- ccxt/async_support/okx.py +10 -3
- ccxt/async_support/onetrading.py +1 -1
- ccxt/async_support/oxfun.py +2 -1
- ccxt/async_support/paradex.py +2 -2
- ccxt/async_support/phemex.py +36 -31
- ccxt/async_support/vertex.py +3 -2
- ccxt/async_support/woo.py +6 -2
- ccxt/async_support/woofipro.py +2 -2
- ccxt/base/decimal_to_precision.py +16 -10
- ccxt/base/errors.py +6 -0
- ccxt/base/exchange.py +60 -17
- ccxt/binance.py +90 -34
- ccxt/binancecoinm.py +5 -1
- ccxt/binanceus.py +3 -1
- ccxt/binanceusdm.py +3 -1
- ccxt/bingx.py +1 -1
- ccxt/bitget.py +30 -143
- ccxt/bitmart.py +2 -2
- ccxt/bitrue.py +13 -8
- ccxt/bybit.py +14 -5
- ccxt/coinbaseexchange.py +4 -2
- ccxt/coinbaseinternational.py +2 -2
- ccxt/coinspot.py +36 -1
- ccxt/cryptocom.py +78 -3
- ccxt/cryptomus.py +41 -1
- ccxt/defx.py +1 -1
- ccxt/derive.py +1 -1
- ccxt/ellipx.py +40 -0
- ccxt/exmo.py +1 -1
- ccxt/foxbit.py +1935 -0
- ccxt/gate.py +1 -2
- ccxt/hashkey.py +39 -0
- ccxt/hyperliquid.py +42 -27
- ccxt/independentreserve.py +35 -0
- ccxt/indodax.py +34 -0
- ccxt/kucoin.py +3 -2
- ccxt/kucoinfutures.py +3 -2
- ccxt/latoken.py +42 -0
- ccxt/luno.py +36 -0
- ccxt/mercado.py +34 -0
- ccxt/mexc.py +31 -32
- ccxt/modetrade.py +3 -3
- ccxt/okcoin.py +1 -1
- ccxt/okx.py +10 -3
- ccxt/onetrading.py +1 -1
- ccxt/oxfun.py +2 -1
- ccxt/paradex.py +2 -2
- ccxt/phemex.py +36 -31
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binancecoinm.py +3 -1
- ccxt/pro/binanceus.py +3 -1
- ccxt/pro/binanceusdm.py +3 -1
- ccxt/pro/bybit.py +33 -1
- ccxt/test/tests_async.py +15 -0
- ccxt/test/tests_sync.py +15 -0
- ccxt/vertex.py +3 -2
- ccxt/woo.py +6 -2
- ccxt/woofipro.py +2 -2
- {ccxt-4.4.95.dist-info → ccxt-4.4.97.dist-info}/METADATA +19 -19
- {ccxt-4.4.95.dist-info → ccxt-4.4.97.dist-info}/RECORD +110 -107
- {ccxt-4.4.95.dist-info → ccxt-4.4.97.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.95.dist-info → ccxt-4.4.97.dist-info}/WHEEL +0 -0
- {ccxt-4.4.95.dist-info → ccxt-4.4.97.dist-info}/top_level.txt +0 -0
ccxt/async_support/bitget.py
CHANGED
@@ -4112,82 +4112,35 @@ class bitget(Exchange, ImplicitAPI):
|
|
4112
4112
|
# "result": "success"
|
4113
4113
|
# }
|
4114
4114
|
#
|
4115
|
-
# spot: fetchOrder
|
4116
|
-
#
|
4117
|
-
# {
|
4118
|
-
# "userId": "7264631750",
|
4119
|
-
# "symbol": "BTCUSDT",
|
4120
|
-
# "orderId": "1111461743123927040",
|
4121
|
-
# "clientOid": "63f95110-93b5-4309-8f77-46339f1bcf3c",
|
4122
|
-
# "price": "25000.0000000000000000",
|
4123
|
-
# "size": "0.0002000000000000",
|
4124
|
-
# "orderType": "limit",
|
4125
|
-
# "side": "buy",
|
4126
|
-
# "status": "live",
|
4127
|
-
# "priceAvg": "0",
|
4128
|
-
# "baseVolume": "0.0000000000000000",
|
4129
|
-
# "quoteVolume": "0.0000000000000000",
|
4130
|
-
# "enterPointSource": "API",
|
4131
|
-
# "feeDetail": "",
|
4132
|
-
# "orderSource": "normal",
|
4133
|
-
# "cTime": "1700719050198",
|
4134
|
-
# "uTime": "1700719050198"
|
4135
|
-
# }
|
4136
|
-
#
|
4137
|
-
# swap and future: fetchOrder
|
4138
|
-
#
|
4139
|
-
# {
|
4140
|
-
# "symbol": "BTCUSDT",
|
4141
|
-
# "size": "0.001",
|
4142
|
-
# "orderId": "1111465253393825792",
|
4143
|
-
# "clientOid": "1111465253431574529",
|
4144
|
-
# "baseVolume": "0",
|
4145
|
-
# "fee": "0",
|
4146
|
-
# "price": "27000",
|
4147
|
-
# "priceAvg": "",
|
4148
|
-
# "state": "live",
|
4149
|
-
# "side": "buy",
|
4150
|
-
# "force": "gtc",
|
4151
|
-
# "totalProfits": "0",
|
4152
|
-
# "posSide": "long",
|
4153
|
-
# "marginCoin": "USDT",
|
4154
|
-
# "presetStopSurplusPrice": "",
|
4155
|
-
# "presetStopLossPrice": "",
|
4156
|
-
# "quoteVolume": "0",
|
4157
|
-
# "orderType": "limit",
|
4158
|
-
# "leverage": "20",
|
4159
|
-
# "marginMode": "crossed",
|
4160
|
-
# "reduceOnly": "NO",
|
4161
|
-
# "enterPointSource": "API",
|
4162
|
-
# "tradeSide": "open",
|
4163
|
-
# "posMode": "hedge_mode",
|
4164
|
-
# "orderSource": "normal",
|
4165
|
-
# "cTime": "1700719887120",
|
4166
|
-
# "uTime": "1700719887120"
|
4167
|
-
# }
|
4168
|
-
#
|
4169
|
-
# spot: fetchOpenOrders
|
4115
|
+
# spot: fetchOrder, fetchOpenOrders, fetchCanceledAndClosedOrders
|
4170
4116
|
#
|
4171
4117
|
# {
|
4172
4118
|
# "userId": "7264631750",
|
4173
4119
|
# "symbol": "BTCUSDT",
|
4174
4120
|
# "orderId": "1111499608327360513",
|
4175
4121
|
# "clientOid": "d0d4dad5-18d0-4869-a074-ec40bb47cba6",
|
4176
|
-
# "
|
4177
|
-
# "
|
4122
|
+
# "size": "0.0002000000000000", # COST for 'buy market' order! AMOUNT in all other cases
|
4123
|
+
# "price": "0", # in fetchOrder: 0 for market order, otherwise limit price(field not present in fetchOpenOrders
|
4178
4124
|
# "orderType": "limit",
|
4179
4125
|
# "side": "buy",
|
4180
4126
|
# "status": "live",
|
4181
4127
|
# "basePrice": "0",
|
4182
|
-
# "
|
4183
|
-
# "
|
4128
|
+
# "priceAvg": "25000.0000000000000000", # 0 if nothing filled
|
4129
|
+
# "baseVolume": "0.0000000000000000", # 0 if nothing filled
|
4130
|
+
# "quoteVolume": "0.0000000000000000", # 0 if nothing filled
|
4184
4131
|
# "enterPointSource": "WEB",
|
4185
4132
|
# "orderSource": "normal",
|
4186
4133
|
# "cTime": "1700728077966",
|
4187
4134
|
# "uTime": "1700728077966"
|
4135
|
+
# "feeDetail": "{\\"newFees\\":{\\"c\\":0,\\"d\\":0,\\"deduction\\":false,\\"r\\":-0.0064699886,\\"t\\":-0.0064699886,\\"totalDeductionFee\\":0},\\"USDT\\":{\\"deduction\\":false,\\"feeCoinCode\\":\\"USDT\\",\\"totalDeductionFee\\":0,\\"totalFee\\":-0.0064699886000000}}", # might not be present in fetchOpenOrders
|
4136
|
+
# "triggerPrice": null,
|
4137
|
+
# "tpslType": "normal",
|
4138
|
+
# "quoteCoin": "USDT", # not present in fetchOpenOrders
|
4139
|
+
# "baseCoin": "DOT", # not present in fetchOpenOrders
|
4140
|
+
# "cancelReason": "", # not present in fetchOpenOrders
|
4188
4141
|
# }
|
4189
4142
|
#
|
4190
|
-
# spot
|
4143
|
+
# spot trigger: fetchOpenOrders, fetchCanceledAndClosedOrders
|
4191
4144
|
#
|
4192
4145
|
# {
|
4193
4146
|
# "orderId": "1111503385931620352",
|
@@ -4228,18 +4181,19 @@ class bitget(Exchange, ImplicitAPI):
|
|
4228
4181
|
# "uTime": "1700729691866"
|
4229
4182
|
# }
|
4230
4183
|
#
|
4231
|
-
# swap: fetchOpenOrders, fetchCanceledAndClosedOrders
|
4184
|
+
# swap and future: fetchOrder, fetchOpenOrders, fetchCanceledAndClosedOrders
|
4232
4185
|
#
|
4233
4186
|
# {
|
4234
4187
|
# "symbol": "BTCUSDT",
|
4235
|
-
# "size": "0.
|
4236
|
-
# "orderId": "
|
4237
|
-
# "clientOid": "
|
4188
|
+
# "size": "0.001",
|
4189
|
+
# "orderId": "1111465253393825792",
|
4190
|
+
# "clientOid": "1111465253431574529",
|
4238
4191
|
# "baseVolume": "0",
|
4239
4192
|
# "fee": "0",
|
4240
|
-
# "price": "
|
4193
|
+
# "price": "27000",
|
4241
4194
|
# "priceAvg": "",
|
4242
|
-
# "
|
4195
|
+
# "state": "live",
|
4196
|
+
# # "status": "live", # key for fetchOpenOrders, fetchClosedOrders
|
4243
4197
|
# "side": "buy",
|
4244
4198
|
# "force": "gtc",
|
4245
4199
|
# "totalProfits": "0",
|
@@ -4248,7 +4202,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4248
4202
|
# "quoteVolume": "0",
|
4249
4203
|
# "leverage": "20",
|
4250
4204
|
# "marginMode": "crossed",
|
4251
|
-
# "enterPointSource": "
|
4205
|
+
# "enterPointSource": "API",
|
4252
4206
|
# "tradeSide": "open",
|
4253
4207
|
# "posMode": "hedge_mode",
|
4254
4208
|
# "orderType": "limit",
|
@@ -4256,94 +4210,22 @@ class bitget(Exchange, ImplicitAPI):
|
|
4256
4210
|
# "presetStopSurplusPrice": "",
|
4257
4211
|
# "presetStopLossPrice": "",
|
4258
4212
|
# "reduceOnly": "NO",
|
4259
|
-
# "cTime": "
|
4260
|
-
# "uTime": "
|
4261
|
-
# }
|
4213
|
+
# "cTime": "1700719887120",
|
4214
|
+
# "uTime": "1700719887120"
|
4262
4215
|
#
|
4263
|
-
# swap
|
4216
|
+
# for swap trigger order, the additional below fields are present:
|
4264
4217
|
#
|
4265
|
-
# {
|
4266
4218
|
# "planType": "normal_plan",
|
4267
|
-
# "symbol": "BTCUSDT",
|
4268
|
-
# "size": "0.001",
|
4269
|
-
# "orderId": "1111491399869075457",
|
4270
|
-
# "clientOid": "1111491399869075456",
|
4271
|
-
# "price": "27000",
|
4272
4219
|
# "callbackRatio": "",
|
4273
4220
|
# "triggerPrice": "24000",
|
4274
4221
|
# "triggerType": "mark_price",
|
4275
4222
|
# "planStatus": "live",
|
4276
|
-
# "side": "buy",
|
4277
|
-
# "posSide": "long",
|
4278
|
-
# "marginCoin": "USDT",
|
4279
|
-
# "marginMode": "crossed",
|
4280
|
-
# "enterPointSource": "API",
|
4281
|
-
# "tradeSide": "open",
|
4282
|
-
# "posMode": "hedge_mode",
|
4283
|
-
# "orderType": "limit",
|
4284
|
-
# "stopSurplusTriggerPrice": "",
|
4285
|
-
# "stopSurplusExecutePrice": "",
|
4286
|
-
# "stopSurplusTriggerType": "fill_price",
|
4287
|
-
# "stopLossTriggerPrice": "",
|
4288
|
-
# "stopLossExecutePrice": "",
|
4289
|
-
# "stopLossTriggerType": "fill_price",
|
4290
|
-
# "cTime": "1700726120917",
|
4291
|
-
# "uTime": "1700726120917"
|
4292
|
-
# }
|
4293
|
-
#
|
4294
|
-
# spot: fetchCanceledAndClosedOrders
|
4295
|
-
#
|
4296
|
-
# {
|
4297
|
-
# "userId": "7264631750",
|
4298
|
-
# "symbol": "BTCUSDT",
|
4299
|
-
# "orderId": "1111499608327360513",
|
4300
|
-
# "clientOid": "d0d4dad5-18d0-4869-a074-ec40bb47cba6",
|
4301
|
-
# "price": "25000.0000000000000000",
|
4302
|
-
# "size": "0.0002000000000000",
|
4303
|
-
# "orderType": "limit",
|
4304
|
-
# "side": "buy",
|
4305
|
-
# "status": "cancelled",
|
4306
|
-
# "priceAvg": "0",
|
4307
|
-
# "baseVolume": "0.0000000000000000",
|
4308
|
-
# "quoteVolume": "0.0000000000000000",
|
4309
|
-
# "enterPointSource": "WEB",
|
4310
|
-
# "feeDetail": "",
|
4311
|
-
# "orderSource": "normal",
|
4312
|
-
# "cTime": "1700728077966",
|
4313
|
-
# "uTime": "1700728911471"
|
4314
|
-
# }
|
4315
|
-
#
|
4316
|
-
# swap stop: fetchCanceledAndClosedOrders
|
4317
|
-
#
|
4318
|
-
# {
|
4319
|
-
# "planType": "normal_plan",
|
4320
|
-
# "symbol": "BTCUSDT",
|
4321
|
-
# "size": "0.001",
|
4322
|
-
# "orderId": "1111491399869075457",
|
4323
|
-
# "clientOid": "1111491399869075456",
|
4324
|
-
# "planStatus": "cancelled",
|
4325
|
-
# "price": "27000",
|
4326
|
-
# "feeDetail": null,
|
4327
|
-
# "baseVolume": "0",
|
4328
|
-
# "callbackRatio": "",
|
4329
|
-
# "triggerPrice": "24000",
|
4330
|
-
# "triggerType": "mark_price",
|
4331
|
-
# "side": "buy",
|
4332
|
-
# "posSide": "long",
|
4333
|
-
# "marginCoin": "USDT",
|
4334
|
-
# "marginMode": "crossed",
|
4335
|
-
# "enterPointSource": "API",
|
4336
|
-
# "tradeSide": "open",
|
4337
|
-
# "posMode": "hedge_mode",
|
4338
|
-
# "orderType": "limit",
|
4339
4223
|
# "stopSurplusTriggerPrice": "",
|
4340
4224
|
# "stopSurplusExecutePrice": "",
|
4341
4225
|
# "stopSurplusTriggerType": "fill_price",
|
4342
4226
|
# "stopLossTriggerPrice": "",
|
4343
4227
|
# "stopLossExecutePrice": "",
|
4344
4228
|
# "stopLossTriggerType": "fill_price",
|
4345
|
-
# "cTime": "1700726120917",
|
4346
|
-
# "uTime": "1700727879652"
|
4347
4229
|
# }
|
4348
4230
|
#
|
4349
4231
|
errorMessage = self.safe_string(order, 'errorMsg')
|
@@ -4421,6 +4303,11 @@ class bitget(Exchange, ImplicitAPI):
|
|
4421
4303
|
side = 'sell' if (side == 'buy') else 'buy'
|
4422
4304
|
# on bitget hedge mode if the position is long the side is always buy, and if the position is short the side is always sell
|
4423
4305
|
# so the side of the reduceOnly order is inversed
|
4306
|
+
orderType = self.safe_string(order, 'orderType')
|
4307
|
+
isBuyMarket = (side == 'buy') and (orderType == 'market')
|
4308
|
+
if market['spot'] and isBuyMarket:
|
4309
|
+
# in top comment, for 'buy market' the 'size' field is COST, not AMOUNT
|
4310
|
+
size = self.safe_string(order, 'baseVolume')
|
4424
4311
|
return self.safe_order({
|
4425
4312
|
'info': order,
|
4426
4313
|
'id': self.safe_string_2(order, 'orderId', 'data'),
|
@@ -4430,7 +4317,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4430
4317
|
'lastTradeTimestamp': updateTimestamp,
|
4431
4318
|
'lastUpdateTimestamp': updateTimestamp,
|
4432
4319
|
'symbol': market['symbol'],
|
4433
|
-
'type':
|
4320
|
+
'type': orderType,
|
4434
4321
|
'side': side,
|
4435
4322
|
'price': price,
|
4436
4323
|
'amount': size,
|
ccxt/async_support/bitmart.py
CHANGED
@@ -3083,7 +3083,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3083
3083
|
# }
|
3084
3084
|
#
|
3085
3085
|
if market['swap']:
|
3086
|
-
return response
|
3086
|
+
return self.safe_order({'info': response})
|
3087
3087
|
data = self.safe_value(response, 'data')
|
3088
3088
|
if data is True:
|
3089
3089
|
return self.safe_order({'id': id}, market)
|
@@ -3200,7 +3200,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3200
3200
|
# "trace": "7f9c94e10f9d4513bc08a7bfc2a5559a.70.16954131323145323"
|
3201
3201
|
# }
|
3202
3202
|
#
|
3203
|
-
return response
|
3203
|
+
return [self.safe_order({'info': response})]
|
3204
3204
|
|
3205
3205
|
async def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
3206
3206
|
if symbol is None:
|
ccxt/async_support/bitrue.py
CHANGED
@@ -395,11 +395,9 @@ class bitrue(Exchange, ImplicitAPI):
|
|
395
395
|
# exchange-specific options
|
396
396
|
'options': {
|
397
397
|
'createMarketBuyOrderRequiresPrice': True,
|
398
|
-
'fetchMarkets':
|
399
|
-
'spot',
|
400
|
-
|
401
|
-
'inverse',
|
402
|
-
],
|
398
|
+
'fetchMarkets': {
|
399
|
+
'types': ['spot', 'linear', 'inverse'],
|
400
|
+
},
|
403
401
|
# 'fetchTradesMethod': 'publicGetAggTrades', # publicGetTrades, publicGetHistoricalTrades
|
404
402
|
'fetchMyTradesMethod': 'v2PrivateGetMyTrades', # spotV1PrivateGetMyTrades
|
405
403
|
'hasAlreadyAuthenticatedSuccessfully': False,
|
@@ -845,9 +843,16 @@ class bitrue(Exchange, ImplicitAPI):
|
|
845
843
|
:returns dict[]: an array of objects representing market data
|
846
844
|
"""
|
847
845
|
promisesRaw = []
|
848
|
-
|
849
|
-
|
850
|
-
|
846
|
+
types = None
|
847
|
+
defaultTypes = ['spot', 'linear', 'inverse']
|
848
|
+
fetchMarketsOptions = self.safe_dict(self.options, 'fetchMarkets')
|
849
|
+
if fetchMarketsOptions is not None:
|
850
|
+
types = self.safe_list(fetchMarketsOptions, 'types', defaultTypes)
|
851
|
+
else:
|
852
|
+
# for backward-compatibility
|
853
|
+
types = self.safe_list(self.options, 'fetchMarkets', defaultTypes)
|
854
|
+
for i in range(0, len(types)):
|
855
|
+
marketType = types[i]
|
851
856
|
if marketType == 'spot':
|
852
857
|
promisesRaw.append(self.spotV1PublicGetExchangeInfo(params))
|
853
858
|
elif marketType == 'linear':
|
ccxt/async_support/bybit.py
CHANGED
@@ -1041,7 +1041,9 @@ class bybit(Exchange, ImplicitAPI):
|
|
1041
1041
|
'options': {
|
1042
1042
|
'usePrivateInstrumentsInfo': False,
|
1043
1043
|
'enableDemoTrading': False,
|
1044
|
-
'fetchMarkets':
|
1044
|
+
'fetchMarkets': {
|
1045
|
+
'types': ['spot', 'linear', 'inverse', 'option'],
|
1046
|
+
},
|
1045
1047
|
'enableUnifiedMargin': None,
|
1046
1048
|
'enableUnifiedAccount': None,
|
1047
1049
|
'unifiedMarginStatus': None,
|
@@ -1702,9 +1704,16 @@ class bybit(Exchange, ImplicitAPI):
|
|
1702
1704
|
if self.options['adjustForTimeDifference']:
|
1703
1705
|
await self.load_time_difference()
|
1704
1706
|
promisesUnresolved = []
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1707
|
+
types = None
|
1708
|
+
defaultTypes = ['spot', 'linear', 'inverse', 'option']
|
1709
|
+
fetchMarketsOptions = self.safe_dict(self.options, 'fetchMarkets')
|
1710
|
+
if fetchMarketsOptions is not None:
|
1711
|
+
types = self.safe_list(fetchMarketsOptions, 'types', defaultTypes)
|
1712
|
+
else:
|
1713
|
+
# for backward-compatibility
|
1714
|
+
types = self.safe_list(self.options, 'fetchMarkets', defaultTypes)
|
1715
|
+
for i in range(0, len(types)):
|
1716
|
+
marketType = types[i]
|
1708
1717
|
if marketType == 'spot':
|
1709
1718
|
promisesUnresolved.append(self.fetch_spot_markets(params))
|
1710
1719
|
elif marketType == 'linear':
|
@@ -4577,7 +4586,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4577
4586
|
result = self.safe_dict(response, 'result', {})
|
4578
4587
|
orders = self.safe_list(result, 'list')
|
4579
4588
|
if not isinstance(orders, list):
|
4580
|
-
return response
|
4589
|
+
return [self.safe_order({'info': response})]
|
4581
4590
|
return self.parse_orders(orders, market)
|
4582
4591
|
|
4583
4592
|
async def fetch_order_classic(self, id: str, symbol: Str = None, params={}) -> Order:
|
@@ -1541,7 +1541,8 @@ class coinbaseexchange(Exchange, ImplicitAPI):
|
|
1541
1541
|
if symbol is not None:
|
1542
1542
|
market = self.market(symbol)
|
1543
1543
|
request['product_id'] = market['symbol'] # the request will be more performant if you include it
|
1544
|
-
|
1544
|
+
response = await getattr(self, method)(self.extend(request, params))
|
1545
|
+
return self.safe_order({'info': response})
|
1545
1546
|
|
1546
1547
|
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
1547
1548
|
"""
|
@@ -1559,7 +1560,8 @@ class coinbaseexchange(Exchange, ImplicitAPI):
|
|
1559
1560
|
if symbol is not None:
|
1560
1561
|
market = self.market(symbol)
|
1561
1562
|
request['product_id'] = market['symbol'] # the request will be more performant if you include it
|
1562
|
-
|
1563
|
+
response = await self.privateDeleteOrders(self.extend(request, params))
|
1564
|
+
return [self.safe_order({'info': response})]
|
1563
1565
|
|
1564
1566
|
async def fetch_payment_methods(self, params={}):
|
1565
1567
|
return await self.privateGetPaymentMethods(params)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.coinbaseinternational import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, Int, Market, Order, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, Int, MarginModification, Market, Order, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -875,7 +875,7 @@ class coinbaseinternational(Exchange, ImplicitAPI):
|
|
875
875
|
},
|
876
876
|
})
|
877
877
|
|
878
|
-
async def set_margin(self, symbol: str, amount: float, params={}) ->
|
878
|
+
async def set_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
879
879
|
"""
|
880
880
|
Either adds or reduces margin in order to set the margin to a specific value
|
881
881
|
|
ccxt/async_support/coinspot.py
CHANGED
@@ -31,33 +31,61 @@ class coinspot(Exchange, ImplicitAPI):
|
|
31
31
|
'future': False,
|
32
32
|
'option': False,
|
33
33
|
'addMargin': False,
|
34
|
+
'borrowCrossMargin': False,
|
35
|
+
'borrowIsolatedMargin': False,
|
36
|
+
'borrowMargin': False,
|
34
37
|
'cancelOrder': True,
|
35
38
|
'closeAllPositions': False,
|
36
39
|
'closePosition': False,
|
37
40
|
'createMarketOrder': False,
|
38
41
|
'createOrder': True,
|
42
|
+
'createOrderWithTakeProfitAndStopLoss': False,
|
43
|
+
'createOrderWithTakeProfitAndStopLossWs': False,
|
44
|
+
'createPostOnlyOrder': False,
|
39
45
|
'createReduceOnlyOrder': False,
|
40
46
|
'createStopLimitOrder': False,
|
41
47
|
'createStopMarketOrder': False,
|
42
48
|
'createStopOrder': False,
|
43
49
|
'fetchBalance': True,
|
50
|
+
'fetchBorrowInterest': False,
|
51
|
+
'fetchBorrowRate': False,
|
44
52
|
'fetchBorrowRateHistories': False,
|
45
53
|
'fetchBorrowRateHistory': False,
|
54
|
+
'fetchBorrowRates': False,
|
55
|
+
'fetchBorrowRatesPerSymbol': False,
|
46
56
|
'fetchCrossBorrowRate': False,
|
47
57
|
'fetchCrossBorrowRates': False,
|
48
58
|
'fetchFundingHistory': False,
|
59
|
+
'fetchFundingInterval': False,
|
60
|
+
'fetchFundingIntervals': False,
|
49
61
|
'fetchFundingRate': False,
|
50
62
|
'fetchFundingRateHistory': False,
|
51
63
|
'fetchFundingRates': False,
|
64
|
+
'fetchGreeks': False,
|
52
65
|
'fetchIndexOHLCV': False,
|
53
66
|
'fetchIsolatedBorrowRate': False,
|
54
67
|
'fetchIsolatedBorrowRates': False,
|
68
|
+
'fetchIsolatedPositions': False,
|
55
69
|
'fetchLeverage': False,
|
70
|
+
'fetchLeverages': False,
|
56
71
|
'fetchLeverageTiers': False,
|
72
|
+
'fetchLiquidations': False,
|
73
|
+
'fetchLongShortRatio': False,
|
74
|
+
'fetchLongShortRatioHistory': False,
|
75
|
+
'fetchMarginAdjustmentHistory': False,
|
57
76
|
'fetchMarginMode': False,
|
77
|
+
'fetchMarginModes': False,
|
78
|
+
'fetchMarketLeverageTiers': False,
|
58
79
|
'fetchMarkOHLCV': False,
|
80
|
+
'fetchMarkPrices': False,
|
81
|
+
'fetchMyLiquidations': False,
|
82
|
+
'fetchMySettlementHistory': False,
|
59
83
|
'fetchMyTrades': True,
|
84
|
+
'fetchOpenInterest': False,
|
60
85
|
'fetchOpenInterestHistory': False,
|
86
|
+
'fetchOpenInterests': False,
|
87
|
+
'fetchOption': False,
|
88
|
+
'fetchOptionChain': False,
|
61
89
|
'fetchOrderBook': True,
|
62
90
|
'fetchPosition': False,
|
63
91
|
'fetchPositionHistory': False,
|
@@ -67,13 +95,19 @@ class coinspot(Exchange, ImplicitAPI):
|
|
67
95
|
'fetchPositionsHistory': False,
|
68
96
|
'fetchPositionsRisk': False,
|
69
97
|
'fetchPremiumIndexOHLCV': False,
|
98
|
+
'fetchSettlementHistory': False,
|
70
99
|
'fetchTicker': True,
|
71
100
|
'fetchTickers': True,
|
72
101
|
'fetchTrades': True,
|
73
102
|
'fetchTradingFee': False,
|
74
103
|
'fetchTradingFees': False,
|
104
|
+
'fetchVolatilityHistory': False,
|
75
105
|
'reduceMargin': False,
|
106
|
+
'repayCrossMargin': False,
|
107
|
+
'repayIsolatedMargin': False,
|
108
|
+
'repayMargin': False,
|
76
109
|
'setLeverage': False,
|
110
|
+
'setMargin': False,
|
77
111
|
'setMarginMode': False,
|
78
112
|
'setPositionMode': False,
|
79
113
|
'ws': False,
|
@@ -551,7 +585,8 @@ class coinspot(Exchange, ImplicitAPI):
|
|
551
585
|
'amount': amount,
|
552
586
|
'rate': price,
|
553
587
|
}
|
554
|
-
|
588
|
+
response = await getattr(self, method)(self.extend(request, params))
|
589
|
+
return self.parse_order(response)
|
555
590
|
|
556
591
|
async def cancel_order(self, id: str, symbol: Str = None, params={}):
|
557
592
|
"""
|
ccxt/async_support/cryptocom.py
CHANGED
@@ -6,7 +6,8 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.cryptocom import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
|
9
|
+
import math
|
10
|
+
from ccxt.base.types import Account, Any, Balances, Currencies, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, TradingFees, Transaction
|
10
11
|
from typing import List
|
11
12
|
from ccxt.base.errors import ExchangeError
|
12
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -79,7 +80,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
79
80
|
'fetchDepositWithdrawFee': 'emulated',
|
80
81
|
'fetchDepositWithdrawFees': True,
|
81
82
|
'fetchFundingHistory': False,
|
82
|
-
'fetchFundingRate':
|
83
|
+
'fetchFundingRate': True,
|
83
84
|
'fetchFundingRateHistory': True,
|
84
85
|
'fetchFundingRates': False,
|
85
86
|
'fetchGreeks': False,
|
@@ -1631,7 +1632,8 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
1631
1632
|
if symbol is not None:
|
1632
1633
|
market = self.market(symbol)
|
1633
1634
|
request['instrument_name'] = market['id']
|
1634
|
-
|
1635
|
+
response = await self.v1PrivatePostPrivateCancelAllOrders(self.extend(request, params))
|
1636
|
+
return [self.safe_order({'info': response})]
|
1635
1637
|
|
1636
1638
|
async def cancel_order(self, id: str, symbol: Str = None, params={}):
|
1637
1639
|
"""
|
@@ -2848,6 +2850,79 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
2848
2850
|
result.append(self.parse_settlement(settlements[i], market))
|
2849
2851
|
return result
|
2850
2852
|
|
2853
|
+
async def fetch_funding_rate(self, symbol: str, params={}):
|
2854
|
+
"""
|
2855
|
+
fetches historical funding rates
|
2856
|
+
|
2857
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-valuations
|
2858
|
+
|
2859
|
+
:param str symbol: unified symbol of the market to fetch the funding rate history for
|
2860
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2861
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>`
|
2862
|
+
"""
|
2863
|
+
await self.load_markets()
|
2864
|
+
market = self.market(symbol)
|
2865
|
+
if not market['swap']:
|
2866
|
+
raise BadSymbol(self.id + ' fetchFundingRate() supports swap contracts only')
|
2867
|
+
request: dict = {
|
2868
|
+
'instrument_name': market['id'],
|
2869
|
+
'valuation_type': 'estimated_funding_rate',
|
2870
|
+
'count': 1,
|
2871
|
+
}
|
2872
|
+
response = await self.v1PublicGetPublicGetValuations(self.extend(request, params))
|
2873
|
+
#
|
2874
|
+
# {
|
2875
|
+
# "id": -1,
|
2876
|
+
# "method": "public/get-valuations",
|
2877
|
+
# "code": 0,
|
2878
|
+
# "result": {
|
2879
|
+
# "data": [
|
2880
|
+
# {
|
2881
|
+
# "v": "-0.000001884",
|
2882
|
+
# "t": 1687892400000
|
2883
|
+
# },
|
2884
|
+
# ],
|
2885
|
+
# "instrument_name": "BTCUSD-PERP"
|
2886
|
+
# }
|
2887
|
+
# }
|
2888
|
+
#
|
2889
|
+
result = self.safe_dict(response, 'result', {})
|
2890
|
+
data = self.safe_list(result, 'data', [])
|
2891
|
+
entry = self.safe_dict(data, 0, {})
|
2892
|
+
return self.parse_funding_rate(entry, market)
|
2893
|
+
|
2894
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
2895
|
+
#
|
2896
|
+
# {
|
2897
|
+
# "v": "-0.000001884",
|
2898
|
+
# "t": 1687892400000
|
2899
|
+
# },
|
2900
|
+
#
|
2901
|
+
timestamp = self.safe_integer(contract, 't')
|
2902
|
+
fundingTimestamp = None
|
2903
|
+
if timestamp is not None:
|
2904
|
+
fundingTimestamp = int(math.ceil(timestamp / 3600000)) * 3600000 # end of the next hour
|
2905
|
+
return {
|
2906
|
+
'info': contract,
|
2907
|
+
'symbol': self.safe_symbol(None, market),
|
2908
|
+
'markPrice': None,
|
2909
|
+
'indexPrice': None,
|
2910
|
+
'interestRate': None,
|
2911
|
+
'estimatedSettlePrice': None,
|
2912
|
+
'timestamp': timestamp,
|
2913
|
+
'datetime': self.iso8601(timestamp),
|
2914
|
+
'fundingRate': self.safe_number(contract, 'v'),
|
2915
|
+
'fundingTimestamp': fundingTimestamp,
|
2916
|
+
'fundingDatetime': self.iso8601(fundingTimestamp),
|
2917
|
+
'nextFundingRate': None,
|
2918
|
+
'nextFundingTimestamp': None,
|
2919
|
+
'nextFundingDatetime': None,
|
2920
|
+
'previousFundingRate': None,
|
2921
|
+
'previousFundingTimestamp': None,
|
2922
|
+
'previousFundingDatetime': None,
|
2923
|
+
'interval': '1h',
|
2924
|
+
}
|
2925
|
+
|
2851
2926
|
async def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
2852
2927
|
"""
|
2853
2928
|
fetches historical funding rates
|