ccxt 4.4.62__py2.py3-none-any.whl → 4.4.63__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/bitmart.py +5 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bingx.py +1 -1
- ccxt/async_support/bitmart.py +155 -54
- ccxt/async_support/bybit.py +5 -5
- ccxt/async_support/gate.py +106 -145
- ccxt/async_support/phemex.py +18 -12
- ccxt/async_support/tradeogre.py +3 -3
- ccxt/async_support/whitebit.py +2 -4
- ccxt/base/errors.py +0 -6
- ccxt/base/exchange.py +12 -7
- ccxt/bingx.py +1 -1
- ccxt/bitmart.py +155 -54
- ccxt/bybit.py +5 -5
- ccxt/gate.py +106 -145
- ccxt/phemex.py +17 -12
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitmart.py +64 -53
- ccxt/tradeogre.py +3 -3
- ccxt/whitebit.py +2 -4
- {ccxt-4.4.62.dist-info → ccxt-4.4.63.dist-info}/METADATA +4 -4
- {ccxt-4.4.62.dist-info → ccxt-4.4.63.dist-info}/RECORD +27 -27
- {ccxt-4.4.62.dist-info → ccxt-4.4.63.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.62.dist-info → ccxt-4.4.63.dist-info}/WHEEL +0 -0
- {ccxt-4.4.62.dist-info → ccxt-4.4.63.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/abstract/bitmart.py
CHANGED
@@ -28,6 +28,7 @@ class ImplicitAPI:
|
|
28
28
|
public_get_contract_public_funding_rate_history = publicGetContractPublicFundingRateHistory = Entry('contract/public/funding-rate-history', 'public', 'GET', {'cost': 30})
|
29
29
|
public_get_contract_public_kline = publicGetContractPublicKline = Entry('contract/public/kline', 'public', 'GET', {'cost': 6})
|
30
30
|
public_get_account_v1_currencies = publicGetAccountV1Currencies = Entry('account/v1/currencies', 'public', 'GET', {'cost': 30})
|
31
|
+
public_get_contract_public_markprice_kline = publicGetContractPublicMarkpriceKline = Entry('contract/public/markprice-kline', 'public', 'GET', {'cost': 5})
|
31
32
|
private_get_account_sub_account_v1_transfer_list = privateGetAccountSubAccountV1TransferList = Entry('account/sub-account/v1/transfer-list', 'private', 'GET', {'cost': 7.5})
|
32
33
|
private_get_account_sub_account_v1_transfer_history = privateGetAccountSubAccountV1TransferHistory = Entry('account/sub-account/v1/transfer-history', 'private', 'GET', {'cost': 7.5})
|
33
34
|
private_get_account_sub_account_main_v1_wallet = privateGetAccountSubAccountMainV1Wallet = Entry('account/sub-account/main/v1/wallet', 'private', 'GET', {'cost': 5})
|
@@ -42,6 +43,7 @@ class ImplicitAPI:
|
|
42
43
|
private_get_account_v1_withdraw_charge = privateGetAccountV1WithdrawCharge = Entry('account/v1/withdraw/charge', 'private', 'GET', {'cost': 32})
|
43
44
|
private_get_account_v2_deposit_withdraw_history = privateGetAccountV2DepositWithdrawHistory = Entry('account/v2/deposit-withdraw/history', 'private', 'GET', {'cost': 7.5})
|
44
45
|
private_get_account_v1_deposit_withdraw_detail = privateGetAccountV1DepositWithdrawDetail = Entry('account/v1/deposit-withdraw/detail', 'private', 'GET', {'cost': 7.5})
|
46
|
+
private_get_account_v1_withdraw_address_list = privateGetAccountV1WithdrawAddressList = Entry('account/v1/withdraw/address/list', 'private', 'GET', {'cost': 30})
|
45
47
|
private_get_spot_v1_order_detail = privateGetSpotV1OrderDetail = Entry('spot/v1/order_detail', 'private', 'GET', {'cost': 1})
|
46
48
|
private_get_spot_v2_orders = privateGetSpotV2Orders = Entry('spot/v2/orders', 'private', 'GET', {'cost': 5})
|
47
49
|
private_get_spot_v1_trades = privateGetSpotV1Trades = Entry('spot/v1/trades', 'private', 'GET', {'cost': 5})
|
@@ -91,7 +93,7 @@ class ImplicitAPI:
|
|
91
93
|
private_post_spot_v3_cancel_order = privatePostSpotV3CancelOrder = Entry('spot/v3/cancel_order', 'private', 'POST', {'cost': 1})
|
92
94
|
private_post_spot_v2_batch_orders = privatePostSpotV2BatchOrders = Entry('spot/v2/batch_orders', 'private', 'POST', {'cost': 1})
|
93
95
|
private_post_spot_v2_submit_order = privatePostSpotV2SubmitOrder = Entry('spot/v2/submit_order', 'private', 'POST', {'cost': 1})
|
94
|
-
private_post_spot_v1_margin_submit_order = privatePostSpotV1MarginSubmitOrder = Entry('spot/v1/margin/submit_order', 'private', 'POST', {'cost': 1})
|
96
|
+
private_post_spot_v1_margin_submit_order = privatePostSpotV1MarginSubmitOrder = Entry('spot/v1/margin/submit_order', 'private', 'POST', {'cost': 1.5})
|
95
97
|
private_post_spot_v1_margin_isolated_borrow = privatePostSpotV1MarginIsolatedBorrow = Entry('spot/v1/margin/isolated/borrow', 'private', 'POST', {'cost': 30})
|
96
98
|
private_post_spot_v1_margin_isolated_repay = privatePostSpotV1MarginIsolatedRepay = Entry('spot/v1/margin/isolated/repay', 'private', 'POST', {'cost': 30})
|
97
99
|
private_post_spot_v1_margin_isolated_transfer = privatePostSpotV1MarginIsolatedTransfer = Entry('spot/v1/margin/isolated/transfer', 'private', 'POST', {'cost': 30})
|
@@ -107,3 +109,5 @@ class ImplicitAPI:
|
|
107
109
|
private_post_contract_private_modify_plan_order = privatePostContractPrivateModifyPlanOrder = Entry('contract/private/modify-plan-order', 'private', 'POST', {'cost': 2.5})
|
108
110
|
private_post_contract_private_modify_preset_plan_order = privatePostContractPrivateModifyPresetPlanOrder = Entry('contract/private/modify-preset-plan-order', 'private', 'POST', {'cost': 2.5})
|
109
111
|
private_post_contract_private_modify_tp_sl_order = privatePostContractPrivateModifyTpSlOrder = Entry('contract/private/modify-tp-sl-order', 'private', 'POST', {'cost': 2.5})
|
112
|
+
private_post_contract_private_submit_trail_order = privatePostContractPrivateSubmitTrailOrder = Entry('contract/private/submit-trail-order', 'private', 'POST', {'cost': 2.5})
|
113
|
+
private_post_contract_private_cancel_trail_order = privatePostContractPrivateCancelTrailOrder = Entry('contract/private/cancel-trail-order', 'private', 'POST', {'cost': 1.5})
|
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/bingx.py
CHANGED
@@ -4472,7 +4472,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
4472
4472
|
response = await self.contractV1PrivateGetAllOrders(self.extend(request, params))
|
4473
4473
|
elif type == 'spot':
|
4474
4474
|
if limit is not None:
|
4475
|
-
request['
|
4475
|
+
request['pageSize'] = limit
|
4476
4476
|
response = await self.spotV1PrivateGetTradeHistoryOrders(self.extend(request, params))
|
4477
4477
|
#
|
4478
4478
|
# {
|
ccxt/async_support/bitmart.py
CHANGED
@@ -91,6 +91,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
91
91
|
'fetchLiquidations': False,
|
92
92
|
'fetchMarginMode': False,
|
93
93
|
'fetchMarkets': True,
|
94
|
+
'fetchMarkOHLCV': True,
|
94
95
|
'fetchMyLiquidations': True,
|
95
96
|
'fetchMyTrades': True,
|
96
97
|
'fetchOHLCV': True,
|
@@ -115,6 +116,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
115
116
|
'fetchTransactionFees': False,
|
116
117
|
'fetchTransfer': False,
|
117
118
|
'fetchTransfers': True,
|
119
|
+
'fetchWithdrawAddresses': True,
|
118
120
|
'fetchWithdrawAddressesByNetwork': False,
|
119
121
|
'fetchWithdrawal': True,
|
120
122
|
'fetchWithdrawals': True,
|
@@ -177,6 +179,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
177
179
|
'contract/public/funding-rate-history': 30,
|
178
180
|
'contract/public/kline': 6, # should be 5 but errors
|
179
181
|
'account/v1/currencies': 30,
|
182
|
+
'contract/public/markprice-kline': 5, # 6 times per 1 second
|
180
183
|
},
|
181
184
|
},
|
182
185
|
'private': {
|
@@ -197,6 +200,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
197
200
|
'account/v1/withdraw/charge': 32, # should be 30 but errors
|
198
201
|
'account/v2/deposit-withdraw/history': 7.5,
|
199
202
|
'account/v1/deposit-withdraw/detail': 7.5,
|
203
|
+
'account/v1/withdraw/address/list': 30, # 2 times per 2 seconds
|
200
204
|
# order
|
201
205
|
'spot/v1/order_detail': 1,
|
202
206
|
'spot/v2/orders': 5,
|
@@ -258,7 +262,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
258
262
|
'spot/v2/batch_orders': 1,
|
259
263
|
'spot/v2/submit_order': 1,
|
260
264
|
# margin
|
261
|
-
'spot/v1/margin/submit_order': 1,
|
265
|
+
'spot/v1/margin/submit_order': 1.5, # 20 times per second
|
262
266
|
'spot/v1/margin/isolated/borrow': 30,
|
263
267
|
'spot/v1/margin/isolated/repay': 30,
|
264
268
|
'spot/v1/margin/isolated/transfer': 30,
|
@@ -275,6 +279,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
275
279
|
'contract/private/modify-plan-order': 2.5,
|
276
280
|
'contract/private/modify-preset-plan-order': 2.5,
|
277
281
|
'contract/private/modify-tp-sl-order': 2.5,
|
282
|
+
'contract/private/submit-trail-order': 2.5, # weight is not provided by the exchange, is set order
|
283
|
+
'contract/private/cancel-trail-order': 1.5, # weight is not provided by the exchange, is set order
|
278
284
|
},
|
279
285
|
},
|
280
286
|
},
|
@@ -870,6 +876,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
870
876
|
async def fetch_time(self, params={}) -> Int:
|
871
877
|
"""
|
872
878
|
fetches the current integer timestamp in milliseconds from the exchange server
|
879
|
+
|
880
|
+
https://developer-pro.bitmart.com/en/spot/#get-system-time
|
881
|
+
|
873
882
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
874
883
|
:returns int: the current integer timestamp in milliseconds from the exchange server
|
875
884
|
"""
|
@@ -890,6 +899,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
890
899
|
async def fetch_status(self, params={}):
|
891
900
|
"""
|
892
901
|
the latest known information on the availability of the exchange API
|
902
|
+
|
903
|
+
https://developer-pro.bitmart.com/en/spot/#get-system-service-status
|
904
|
+
|
893
905
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
894
906
|
:returns dict: a `status structure <https://docs.ccxt.com/#/?id=exchange-status-structure>`
|
895
907
|
"""
|
@@ -1163,10 +1175,11 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1163
1175
|
|
1164
1176
|
async def fetch_markets(self, params={}) -> List[Market]:
|
1165
1177
|
"""
|
1178
|
+
retrieves data on all markets for bitmart
|
1166
1179
|
|
1180
|
+
https://developer-pro.bitmart.com/en/spot/#get-trading-pair-details-v1
|
1167
1181
|
https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
|
1168
1182
|
|
1169
|
-
retrieves data on all markets for bitmart
|
1170
1183
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1171
1184
|
:returns dict[]: an array of objects representing market data
|
1172
1185
|
"""
|
@@ -1179,6 +1192,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1179
1192
|
async def fetch_currencies(self, params={}) -> Currencies:
|
1180
1193
|
"""
|
1181
1194
|
fetches all available currencies on an exchange
|
1195
|
+
|
1196
|
+
https://developer-pro.bitmart.com/en/spot/#get-currency-list-v1
|
1197
|
+
|
1182
1198
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1183
1199
|
:returns dict: an associative dictionary of currencies
|
1184
1200
|
"""
|
@@ -1186,8 +1202,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1186
1202
|
#
|
1187
1203
|
# {
|
1188
1204
|
# "message": "OK",
|
1189
|
-
# "code":1000,
|
1190
|
-
# "trace": "
|
1205
|
+
# "code": 1000,
|
1206
|
+
# "trace": "619294ecef584282b26a3be322b1e01f.66.17403093228242228",
|
1191
1207
|
# "data": {
|
1192
1208
|
# "currencies": [
|
1193
1209
|
# {
|
@@ -1198,7 +1214,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1198
1214
|
# "withdraw_enabled": True,
|
1199
1215
|
# "deposit_enabled": True,
|
1200
1216
|
# "withdraw_minsize": "0.0003",
|
1201
|
-
# "withdraw_minfee": "9.
|
1217
|
+
# "withdraw_minfee": "9.61",
|
1218
|
+
# "withdraw_fee_estimate": "9.61",
|
1219
|
+
# "withdraw_fee": "0.0001"
|
1202
1220
|
# }
|
1203
1221
|
# ]
|
1204
1222
|
# }
|
@@ -1242,7 +1260,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1242
1260
|
'withdraw': withdraw,
|
1243
1261
|
'deposit': deposit,
|
1244
1262
|
'active': withdraw and deposit,
|
1245
|
-
'fee': self.safe_number(currency, '
|
1263
|
+
'fee': self.safe_number(currency, 'withdraw_fee'),
|
1246
1264
|
'limits': {
|
1247
1265
|
'withdraw': {
|
1248
1266
|
'min': self.safe_number(currency, 'withdraw_minsize'),
|
@@ -1354,6 +1372,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1354
1372
|
async def fetch_deposit_withdraw_fee(self, code: str, params={}):
|
1355
1373
|
"""
|
1356
1374
|
fetch the fee for deposits and withdrawals
|
1375
|
+
|
1376
|
+
https://developer-pro.bitmart.com/en/spot/#withdraw-quota-keyed
|
1377
|
+
|
1357
1378
|
:param str code: unified currency code
|
1358
1379
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1359
1380
|
:param str [params.network]: the network code of the currency
|
@@ -1743,7 +1764,6 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1743
1764
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
1744
1765
|
|
1745
1766
|
https://developer-pro.bitmart.com/en/spot/#get-depth-v3
|
1746
|
-
https://developer-pro.bitmart.com/en/futures/#get-market-depth
|
1747
1767
|
https://developer-pro.bitmart.com/en/futuresv2/#get-market-depth
|
1748
1768
|
|
1749
1769
|
:param str symbol: unified symbol of the market to fetch the order book for
|
@@ -2074,7 +2094,12 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2074
2094
|
request, params = self.handle_until_option('end_time', request, params, 0.001)
|
2075
2095
|
response = None
|
2076
2096
|
if market['swap']:
|
2077
|
-
|
2097
|
+
price = self.safe_string(params, 'price')
|
2098
|
+
if price == 'mark':
|
2099
|
+
params = self.omit(params, 'price')
|
2100
|
+
response = await self.publicGetContractPublicMarkpriceKline(self.extend(request, params))
|
2101
|
+
else:
|
2102
|
+
response = await self.publicGetContractPublicKline(self.extend(request, params))
|
2078
2103
|
else:
|
2079
2104
|
response = await self.publicGetSpotQuotationV3Klines(self.extend(request, params))
|
2080
2105
|
#
|
@@ -2117,7 +2142,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2117
2142
|
"""
|
2118
2143
|
|
2119
2144
|
https://developer-pro.bitmart.com/en/spot/#account-trade-list-v4-signed
|
2120
|
-
https://developer-pro.bitmart.com/en/
|
2145
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-order-trade-keyed
|
2121
2146
|
|
2122
2147
|
fetch all trades made by the user
|
2123
2148
|
:param str symbol: unified market symbol
|
@@ -2290,11 +2315,10 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2290
2315
|
"""
|
2291
2316
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
2292
2317
|
|
2293
|
-
https://developer-pro.bitmart.com/en/spot/#get-spot-wallet-balance
|
2294
|
-
https://developer-pro.bitmart.com/en/futures/#get-contract-assets-detail
|
2318
|
+
https://developer-pro.bitmart.com/en/spot/#get-spot-wallet-balance-keyed
|
2295
2319
|
https://developer-pro.bitmart.com/en/futuresv2/#get-contract-assets-keyed
|
2296
|
-
https://developer-pro.bitmart.com/en/spot/#get-account-balance
|
2297
|
-
https://developer-pro.bitmart.com/en/spot/#get-margin-account-details-isolated
|
2320
|
+
https://developer-pro.bitmart.com/en/spot/#get-account-balance-keyed
|
2321
|
+
https://developer-pro.bitmart.com/en/spot/#get-margin-account-details-isolated-keyed
|
2298
2322
|
|
2299
2323
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2300
2324
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
@@ -2342,8 +2366,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2342
2366
|
# "trace":"5c3b7fc7-93b2-49ef-bb59-7fdc56915b59",
|
2343
2367
|
# "data":{
|
2344
2368
|
# "wallet":[
|
2345
|
-
# {"currency":"BTC","name":"Bitcoin","available":"0.00000062","frozen":"0.00000000"},
|
2346
|
-
# {"currency":"ETH","name":"Ethereum","available":"0.00002277","frozen":"0.00000000"}
|
2369
|
+
# {"currency":"BTC","name":"Bitcoin","available":"0.00000062","frozen":"0.00000000","available_usd_valuation":null},
|
2370
|
+
# {"currency":"ETH","name":"Ethereum","available":"0.00002277","frozen":"0.00000000","available_usd_valuation":null}
|
2347
2371
|
# ]
|
2348
2372
|
# }
|
2349
2373
|
# }
|
@@ -2436,6 +2460,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2436
2460
|
async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
|
2437
2461
|
"""
|
2438
2462
|
fetch the trading fees for a market
|
2463
|
+
|
2464
|
+
https://developer-pro.bitmart.com/en/spot/#get-actual-trade-fee-rate-keyed
|
2465
|
+
|
2439
2466
|
:param str symbol: unified market symbol
|
2440
2467
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2441
2468
|
:returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
|
@@ -2644,11 +2671,11 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2644
2671
|
create a trade order
|
2645
2672
|
|
2646
2673
|
https://developer-pro.bitmart.com/en/spot/#new-order-v2-signed
|
2647
|
-
https://developer-pro.bitmart.com/en/spot/#
|
2648
|
-
https://developer-pro.bitmart.com/en/
|
2649
|
-
https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
2674
|
+
https://developer-pro.bitmart.com/en/spot/#new-margin-order-v1-signed
|
2675
|
+
https://developer-pro.bitmart.com/en/futuresv2/#submit-order-signed
|
2650
2676
|
https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
|
2651
|
-
https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-
|
2677
|
+
https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-sl-order-signed
|
2678
|
+
https://developer-pro.bitmart.com/en/futuresv2/#submit-trail-order-signed
|
2652
2679
|
|
2653
2680
|
:param str symbol: unified symbol of the market to create an order in
|
2654
2681
|
:param str type: 'market', 'limit' or 'trailing' for swap markets only
|
@@ -2691,7 +2718,11 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2691
2718
|
response = await self.privatePostSpotV2SubmitOrder(spotRequest)
|
2692
2719
|
else:
|
2693
2720
|
swapRequest = self.create_swap_order_request(symbol, type, side, amount, price, params)
|
2694
|
-
|
2721
|
+
activationPrice = self.safe_string(swapRequest, 'activation_price')
|
2722
|
+
if activationPrice is not None:
|
2723
|
+
# if type is trailing
|
2724
|
+
response = await self.privatePostContractPrivateSubmitTrailOrder(swapRequest)
|
2725
|
+
elif isTriggerOrder:
|
2695
2726
|
response = await self.privatePostContractPrivateSubmitPlanOrder(swapRequest)
|
2696
2727
|
elif isStopLoss or isTakeProfit:
|
2697
2728
|
response = await self.privatePostContractPrivateSubmitTpSlOrder(swapRequest)
|
@@ -2790,7 +2821,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2790
2821
|
create a trade order
|
2791
2822
|
https://developer-pro.bitmart.com/en/futuresv2/#submit-order-signed
|
2792
2823
|
https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
|
2793
|
-
https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-
|
2824
|
+
https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-sl-order-signed
|
2825
|
+
https://developer-pro.bitmart.com/en/futuresv2/#submit-trail-order-signed
|
2794
2826
|
:param str symbol: unified symbol of the market to create an order in
|
2795
2827
|
:param str type: 'market', 'limit', 'trailing', 'stop_loss', or 'take_profit'
|
2796
2828
|
:param str side: 'buy' or 'sell'
|
@@ -2823,7 +2855,6 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2823
2855
|
type = 'take_profit'
|
2824
2856
|
request: dict = {
|
2825
2857
|
'symbol': market['id'],
|
2826
|
-
'type': type,
|
2827
2858
|
'size': int(self.amount_to_precision(symbol, amount)),
|
2828
2859
|
}
|
2829
2860
|
timeInForce = self.safe_string(params, 'timeInForce')
|
@@ -2851,6 +2882,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2851
2882
|
if isLimitOrder:
|
2852
2883
|
request['price'] = self.price_to_precision(symbol, price)
|
2853
2884
|
elif type == 'trailing' or isTrailingPercentOrder:
|
2885
|
+
type = 'trailing'
|
2854
2886
|
request['callback_rate'] = trailingPercent
|
2855
2887
|
request['activation_price'] = self.price_to_precision(symbol, trailingTriggerPrice)
|
2856
2888
|
request['activation_price_type'] = self.safe_integer(params, 'activation_price_type', 1)
|
@@ -2901,14 +2933,16 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2901
2933
|
request['leverage'] = self.number_to_string(leverage)
|
2902
2934
|
elif isTriggerOrder:
|
2903
2935
|
request['leverage'] = '1' # for plan orders leverage is required, if not available default to 1
|
2936
|
+
if type != 'trailing':
|
2937
|
+
request['type'] = type
|
2904
2938
|
return self.extend(request, params)
|
2905
2939
|
|
2906
2940
|
def create_spot_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
2907
2941
|
"""
|
2908
2942
|
@ignore
|
2909
2943
|
create a spot order request
|
2910
|
-
https://developer-pro.bitmart.com/en/spot/#
|
2911
|
-
https://developer-pro.bitmart.com/en/spot/#
|
2944
|
+
https://developer-pro.bitmart.com/en/spot/#new-order-v2-signed
|
2945
|
+
https://developer-pro.bitmart.com/en/spot/#new-margin-order-v1-signed
|
2912
2946
|
:param str symbol: unified symbol of the market to create an order in
|
2913
2947
|
:param str type: 'market' or 'limit'
|
2914
2948
|
:param str side: 'buy' or 'sell'
|
@@ -2972,18 +3006,18 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2972
3006
|
"""
|
2973
3007
|
cancels an open order
|
2974
3008
|
|
2975
|
-
https://developer-pro.bitmart.com/en/
|
3009
|
+
https://developer-pro.bitmart.com/en/futuresv2/#cancel-order-signed
|
2976
3010
|
https://developer-pro.bitmart.com/en/spot/#cancel-order-v3-signed
|
2977
|
-
https://developer-pro.bitmart.com/en/
|
2978
|
-
https://developer-pro.bitmart.com/en/
|
2979
|
-
https://developer-pro.bitmart.com/en/
|
2980
|
-
https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
3011
|
+
https://developer-pro.bitmart.com/en/futuresv2/#cancel-plan-order-signed
|
3012
|
+
https://developer-pro.bitmart.com/en/futuresv2/#cancel-order-signed
|
3013
|
+
https://developer-pro.bitmart.com/en/futuresv2/#cancel-trail-order-signed
|
2981
3014
|
|
2982
3015
|
:param str id: order id
|
2983
3016
|
:param str symbol: unified symbol of the market the order was made in
|
2984
3017
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2985
3018
|
:param str [params.clientOrderId]: *spot only* the client order id of the order to cancel
|
2986
3019
|
:param boolean [params.trigger]: *swap only* whether the order is a trigger order
|
3020
|
+
:param boolean [params.trailing]: *swap only* whether the order is a stop order
|
2987
3021
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2988
3022
|
"""
|
2989
3023
|
if symbol is None:
|
@@ -3004,11 +3038,14 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3004
3038
|
response = await self.privatePostSpotV3CancelOrder(self.extend(request, params))
|
3005
3039
|
else:
|
3006
3040
|
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
3041
|
+
trailing = self.safe_bool(params, 'trailing')
|
3007
3042
|
params = self.omit(params, ['stop', 'trigger'])
|
3008
|
-
if
|
3009
|
-
response = await self.privatePostContractPrivateCancelOrder(self.extend(request, params))
|
3010
|
-
else:
|
3043
|
+
if trigger:
|
3011
3044
|
response = await self.privatePostContractPrivateCancelPlanOrder(self.extend(request, params))
|
3045
|
+
elif trailing:
|
3046
|
+
response = await self.privatePostContractPrivateCancelTrailOrder(self.extend(request, params))
|
3047
|
+
else:
|
3048
|
+
response = await self.privatePostContractPrivateCancelOrder(self.extend(request, params))
|
3012
3049
|
# swap
|
3013
3050
|
# {"code":1000,"message":"Ok","trace":"7f9c94e10f9d4513bc08a7bfc2a5559a.55.16959817848001851"}
|
3014
3051
|
#
|
@@ -3109,9 +3146,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3109
3146
|
"""
|
3110
3147
|
cancel all open orders in a market
|
3111
3148
|
|
3112
|
-
https://developer-pro.bitmart.com/en/spot/#cancel-all-
|
3113
|
-
https://developer-pro.bitmart.com/en/spot/#new-batch-order-v4-signed
|
3114
|
-
https://developer-pro.bitmart.com/en/futures/#cancel-all-orders-signed
|
3149
|
+
https://developer-pro.bitmart.com/en/spot/#cancel-all-order-v4-signed
|
3115
3150
|
https://developer-pro.bitmart.com/en/futuresv2/#cancel-all-orders-signed
|
3116
3151
|
|
3117
3152
|
:param str symbol: unified market symbol of the market to cancel orders in
|
@@ -3211,8 +3246,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3211
3246
|
"""
|
3212
3247
|
|
3213
3248
|
https://developer-pro.bitmart.com/en/spot/#current-open-orders-v4-signed
|
3214
|
-
https://developer-pro.bitmart.com/en/
|
3215
|
-
https://developer-pro.bitmart.com/en/
|
3249
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-all-open-orders-keyed
|
3250
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-all-current-plan-orders-keyed
|
3216
3251
|
|
3217
3252
|
fetch all unfilled currently open orders
|
3218
3253
|
:param str symbol: unified market symbol
|
@@ -3330,7 +3365,6 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3330
3365
|
"""
|
3331
3366
|
|
3332
3367
|
https://developer-pro.bitmart.com/en/spot/#account-orders-v4-signed
|
3333
|
-
https://developer-pro.bitmart.com/en/futures/#get-order-history-keyed
|
3334
3368
|
https://developer-pro.bitmart.com/en/futuresv2/#get-order-history-keyed
|
3335
3369
|
|
3336
3370
|
fetches information on multiple closed orders made by the user
|
@@ -3390,7 +3424,6 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3390
3424
|
|
3391
3425
|
https://developer-pro.bitmart.com/en/spot/#query-order-by-id-v4-signed
|
3392
3426
|
https://developer-pro.bitmart.com/en/spot/#query-order-by-clientorderid-v4-signed
|
3393
|
-
https://developer-pro.bitmart.com/en/futures/#get-order-detail-keyed
|
3394
3427
|
https://developer-pro.bitmart.com/en/futuresv2/#get-order-detail-keyed
|
3395
3428
|
|
3396
3429
|
:param str id: the id of the order
|
@@ -3519,6 +3552,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3519
3552
|
|
3520
3553
|
def parse_deposit_address(self, depositAddress, currency=None) -> DepositAddress:
|
3521
3554
|
#
|
3555
|
+
# fetchDepositAddress
|
3522
3556
|
# {
|
3523
3557
|
# currency: 'ETH',
|
3524
3558
|
# chain: 'Ethereum',
|
@@ -3526,8 +3560,19 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3526
3560
|
# address_memo: ''
|
3527
3561
|
# }
|
3528
3562
|
#
|
3563
|
+
# fetchWithdrawAddress
|
3564
|
+
# {
|
3565
|
+
# "currency": "ETH",
|
3566
|
+
# "network": "ETH",
|
3567
|
+
# "address": "0x1121",
|
3568
|
+
# "memo": "12",
|
3569
|
+
# "remark": "12",
|
3570
|
+
# "addressType": 0,
|
3571
|
+
# "verifyStatus": 0
|
3572
|
+
# }
|
3573
|
+
#
|
3529
3574
|
currencyId = self.safe_string(depositAddress, 'currency')
|
3530
|
-
network = self.
|
3575
|
+
network = self.safe_string_2(depositAddress, 'chain', 'network')
|
3531
3576
|
if currencyId.find('NFT') < 0:
|
3532
3577
|
parts = currencyId.split('-')
|
3533
3578
|
currencyId = self.safe_string(parts, 0)
|
@@ -3542,12 +3587,15 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3542
3587
|
'currency': self.safe_string(currency, 'code'),
|
3543
3588
|
'network': self.network_id_to_code(network),
|
3544
3589
|
'address': address,
|
3545
|
-
'tag': self.
|
3590
|
+
'tag': self.safe_string_2(depositAddress, 'address_memo', 'memo'),
|
3546
3591
|
}
|
3547
3592
|
|
3548
3593
|
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
|
3549
3594
|
"""
|
3550
3595
|
make a withdrawal
|
3596
|
+
|
3597
|
+
https://developer-pro.bitmart.com/en/spot/#withdraw-signed
|
3598
|
+
|
3551
3599
|
:param str code: unified currency code
|
3552
3600
|
:param float amount: the amount to withdraw
|
3553
3601
|
:param str address: the address to withdraw to
|
@@ -3592,16 +3640,21 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3592
3640
|
async def fetch_transactions_by_type(self, type, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
3593
3641
|
await self.load_markets()
|
3594
3642
|
if limit is None:
|
3595
|
-
limit =
|
3643
|
+
limit = 1000 # max 1000
|
3596
3644
|
request: dict = {
|
3597
3645
|
'operation_type': type, # deposit or withdraw
|
3598
|
-
'offset': 1,
|
3599
3646
|
'N': limit,
|
3600
3647
|
}
|
3601
3648
|
currency = None
|
3602
3649
|
if code is not None:
|
3603
3650
|
currency = self.currency(code)
|
3604
3651
|
request['currency'] = currency['id']
|
3652
|
+
if since is not None:
|
3653
|
+
request['startTime'] = since
|
3654
|
+
until = self.safe_integer(params, 'until')
|
3655
|
+
if until is not None:
|
3656
|
+
params = self.omit(params, 'until')
|
3657
|
+
request['endTime'] = until
|
3605
3658
|
response = await self.privateGetAccountV2DepositWithdrawHistory(self.extend(request, params))
|
3606
3659
|
#
|
3607
3660
|
# {
|
@@ -3634,6 +3687,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3634
3687
|
async def fetch_deposit(self, id: str, code: Str = None, params={}):
|
3635
3688
|
"""
|
3636
3689
|
fetch information on a deposit
|
3690
|
+
|
3691
|
+
https://developer-pro.bitmart.com/en/spot/#get-a-deposit-or-withdraw-detail-keyed
|
3692
|
+
|
3637
3693
|
:param str id: deposit id
|
3638
3694
|
:param str code: not used by bitmart fetchDeposit()
|
3639
3695
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -3673,6 +3729,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3673
3729
|
async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
3674
3730
|
"""
|
3675
3731
|
fetch all deposits made to an account
|
3732
|
+
|
3733
|
+
https://developer-pro.bitmart.com/en/spot/#get-deposit-and-withdraw-history-keyed
|
3734
|
+
|
3676
3735
|
:param str code: unified currency code
|
3677
3736
|
:param int [since]: the earliest time in ms to fetch deposits for
|
3678
3737
|
:param int [limit]: the maximum number of deposits structures to retrieve
|
@@ -3684,6 +3743,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3684
3743
|
async def fetch_withdrawal(self, id: str, code: Str = None, params={}):
|
3685
3744
|
"""
|
3686
3745
|
fetch data on a currency withdrawal via the withdrawal id
|
3746
|
+
|
3747
|
+
https://developer-pro.bitmart.com/en/spot/#get-a-deposit-or-withdraw-detail-keyed
|
3748
|
+
|
3687
3749
|
:param str id: withdrawal id
|
3688
3750
|
:param str code: not used by bitmart.fetchWithdrawal
|
3689
3751
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -3723,6 +3785,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3723
3785
|
async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
3724
3786
|
"""
|
3725
3787
|
fetch all withdrawals made from an account
|
3788
|
+
|
3789
|
+
https://developer-pro.bitmart.com/en/spot/#get-deposit-and-withdraw-history-keyed
|
3790
|
+
|
3726
3791
|
:param str code: unified currency code
|
3727
3792
|
:param int [since]: the earliest time in ms to fetch withdrawals for
|
3728
3793
|
:param int [limit]: the maximum number of withdrawals structures to retrieve
|
@@ -3823,7 +3888,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3823
3888
|
"""
|
3824
3889
|
repay borrowed margin and interest
|
3825
3890
|
|
3826
|
-
https://developer-pro.bitmart.com/en/spot/#margin-repay-isolated
|
3891
|
+
https://developer-pro.bitmart.com/en/spot/#margin-repay-isolated-signed
|
3827
3892
|
|
3828
3893
|
:param str symbol: unified market symbol
|
3829
3894
|
:param str code: unified currency code of the currency to repay
|
@@ -3861,7 +3926,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3861
3926
|
"""
|
3862
3927
|
create a loan to borrow margin
|
3863
3928
|
|
3864
|
-
https://developer-pro.bitmart.com/en/spot/#margin-borrow-isolated
|
3929
|
+
https://developer-pro.bitmart.com/en/spot/#margin-borrow-isolated-signed
|
3865
3930
|
|
3866
3931
|
:param str symbol: unified market symbol
|
3867
3932
|
:param str code: unified currency code of the currency to borrow
|
@@ -4066,7 +4131,6 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4066
4131
|
transfer currency internally between wallets on the same account, currently only supports transfer between spot and margin
|
4067
4132
|
|
4068
4133
|
https://developer-pro.bitmart.com/en/spot/#margin-asset-transfer-signed
|
4069
|
-
https://developer-pro.bitmart.com/en/futures/#transfer-signed
|
4070
4134
|
https://developer-pro.bitmart.com/en/futuresv2/#transfer-signed
|
4071
4135
|
|
4072
4136
|
:param str code: unified currency code
|
@@ -4198,7 +4262,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4198
4262
|
"""
|
4199
4263
|
fetch a history of internal transfers made on an account, only transfers between spot and swap are supported
|
4200
4264
|
|
4201
|
-
https://developer-pro.bitmart.com/en/
|
4265
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-transfer-list-signed
|
4202
4266
|
|
4203
4267
|
:param str code: unified currency code of the currency transferred
|
4204
4268
|
:param int [since]: the earliest time in ms to fetch transfers for
|
@@ -4256,7 +4320,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4256
4320
|
"""
|
4257
4321
|
fetch the interest owed by the user for borrowing currency for margin trading
|
4258
4322
|
|
4259
|
-
https://developer-pro.bitmart.com/en/spot/#get-borrow-record-isolated
|
4323
|
+
https://developer-pro.bitmart.com/en/spot/#get-borrow-record-isolated-keyed
|
4260
4324
|
|
4261
4325
|
:param str code: unified currency code
|
4262
4326
|
:param str symbol: unified market symbol when fetch interest in isolated markets
|
@@ -4389,7 +4453,6 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4389
4453
|
"""
|
4390
4454
|
set the level of leverage for a market
|
4391
4455
|
|
4392
|
-
https://developer-pro.bitmart.com/en/futures/#submit-leverage-signed
|
4393
4456
|
https://developer-pro.bitmart.com/en/futuresv2/#submit-leverage-signed
|
4394
4457
|
|
4395
4458
|
:param float leverage: the rate of leverage
|
@@ -4540,8 +4603,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4540
4603
|
"""
|
4541
4604
|
fetch data on a single open contract trade position
|
4542
4605
|
|
4543
|
-
https://developer-pro.bitmart.com/en/
|
4544
|
-
https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
|
4606
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-keyed
|
4545
4607
|
|
4546
4608
|
:param str symbol: unified market symbol of the market the position is held in
|
4547
4609
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -4590,8 +4652,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4590
4652
|
"""
|
4591
4653
|
fetch all open contract positions
|
4592
4654
|
|
4593
|
-
https://developer-pro.bitmart.com/en/
|
4594
|
-
https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
|
4655
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-keyed
|
4595
4656
|
|
4596
4657
|
:param str[]|None symbols: list of unified market symbols
|
4597
4658
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -4713,7 +4774,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4713
4774
|
"""
|
4714
4775
|
retrieves the users liquidated positions
|
4715
4776
|
|
4716
|
-
https://developer-pro.bitmart.com/en/
|
4777
|
+
https://developer-pro.bitmart.com/en/futuresv2/#get-order-history-keyed
|
4717
4778
|
|
4718
4779
|
:param str symbol: unified CCXT market symbol
|
4719
4780
|
:param int [since]: the earliest time in ms to fetch liquidations for
|
@@ -5100,6 +5161,46 @@ class bitmart(Exchange, ImplicitAPI):
|
|
5100
5161
|
sorted = self.sort_by(result, 'timestamp')
|
5101
5162
|
return self.filter_by_since_limit(sorted, since, limit)
|
5102
5163
|
|
5164
|
+
async def fetch_withdraw_addresses(self, code: str, note=None, networkCode=None, params={}):
|
5165
|
+
await self.load_markets()
|
5166
|
+
codes = None
|
5167
|
+
if code is not None:
|
5168
|
+
currency = self.currency(code)
|
5169
|
+
code = currency['code']
|
5170
|
+
codes = [code]
|
5171
|
+
response = await self.privateGetAccountV1WithdrawAddressList(params)
|
5172
|
+
#
|
5173
|
+
# {
|
5174
|
+
# "message": "OK",
|
5175
|
+
# "code": 1000,
|
5176
|
+
# "trace": "0e6edd79-f77f-4251-abe5-83ba75d06c1a",
|
5177
|
+
# "data": {
|
5178
|
+
# "list": [
|
5179
|
+
# {
|
5180
|
+
# "currency": "ETH",
|
5181
|
+
# "network": "ETH",
|
5182
|
+
# "address": "0x1121",
|
5183
|
+
# "memo": "12",
|
5184
|
+
# "remark": "12",
|
5185
|
+
# "addressType": 0,
|
5186
|
+
# "verifyStatus": 0
|
5187
|
+
# }
|
5188
|
+
# ]
|
5189
|
+
# }
|
5190
|
+
# }
|
5191
|
+
#
|
5192
|
+
data = self.safe_dict(response, 'data', {})
|
5193
|
+
list = self.safe_list(data, 'list', [])
|
5194
|
+
allAddresses = self.parse_deposit_addresses(list, codes, False)
|
5195
|
+
addresses = []
|
5196
|
+
for i in range(0, len(allAddresses)):
|
5197
|
+
address = allAddresses[i]
|
5198
|
+
noteMatch = (note is None) or (address['note'] == note)
|
5199
|
+
networkMatch = (networkCode is None) or (address['network'] == networkCode)
|
5200
|
+
if noteMatch and networkMatch:
|
5201
|
+
addresses.append(address)
|
5202
|
+
return addresses
|
5203
|
+
|
5103
5204
|
def nonce(self):
|
5104
5205
|
return self.milliseconds() - self.options['timeDifference']
|
5105
5206
|
|