ccxt 4.4.62 → 4.4.64

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.
@@ -72,6 +72,7 @@ class bitmart extends bitmart$1 {
72
72
  'fetchLiquidations': false,
73
73
  'fetchMarginMode': false,
74
74
  'fetchMarkets': true,
75
+ 'fetchMarkOHLCV': true,
75
76
  'fetchMyLiquidations': true,
76
77
  'fetchMyTrades': true,
77
78
  'fetchOHLCV': true,
@@ -96,6 +97,7 @@ class bitmart extends bitmart$1 {
96
97
  'fetchTransactionFees': false,
97
98
  'fetchTransfer': false,
98
99
  'fetchTransfers': true,
100
+ 'fetchWithdrawAddresses': true,
99
101
  'fetchWithdrawAddressesByNetwork': false,
100
102
  'fetchWithdrawal': true,
101
103
  'fetchWithdrawals': true,
@@ -158,6 +160,7 @@ class bitmart extends bitmart$1 {
158
160
  'contract/public/funding-rate-history': 30,
159
161
  'contract/public/kline': 6,
160
162
  'account/v1/currencies': 30,
163
+ 'contract/public/markprice-kline': 5, // 6 times per 1 second
161
164
  },
162
165
  },
163
166
  'private': {
@@ -178,6 +181,7 @@ class bitmart extends bitmart$1 {
178
181
  'account/v1/withdraw/charge': 32,
179
182
  'account/v2/deposit-withdraw/history': 7.5,
180
183
  'account/v1/deposit-withdraw/detail': 7.5,
184
+ 'account/v1/withdraw/address/list': 30,
181
185
  // order
182
186
  'spot/v1/order_detail': 1,
183
187
  'spot/v2/orders': 5,
@@ -239,7 +243,7 @@ class bitmart extends bitmart$1 {
239
243
  'spot/v2/batch_orders': 1,
240
244
  'spot/v2/submit_order': 1,
241
245
  // margin
242
- 'spot/v1/margin/submit_order': 1,
246
+ 'spot/v1/margin/submit_order': 1.5,
243
247
  'spot/v1/margin/isolated/borrow': 30,
244
248
  'spot/v1/margin/isolated/repay': 30,
245
249
  'spot/v1/margin/isolated/transfer': 30,
@@ -256,6 +260,8 @@ class bitmart extends bitmart$1 {
256
260
  'contract/private/modify-plan-order': 2.5,
257
261
  'contract/private/modify-preset-plan-order': 2.5,
258
262
  'contract/private/modify-tp-sl-order': 2.5,
263
+ 'contract/private/submit-trail-order': 2.5,
264
+ 'contract/private/cancel-trail-order': 1.5, // weight is not provided by the exchange, is set as ordinary order
259
265
  },
260
266
  },
261
267
  },
@@ -852,6 +858,7 @@ class bitmart extends bitmart$1 {
852
858
  * @method
853
859
  * @name bitmart#fetchTime
854
860
  * @description fetches the current integer timestamp in milliseconds from the exchange server
861
+ * @see https://developer-pro.bitmart.com/en/spot/#get-system-time
855
862
  * @param {object} [params] extra parameters specific to the exchange API endpoint
856
863
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
857
864
  */
@@ -874,6 +881,7 @@ class bitmart extends bitmart$1 {
874
881
  * @method
875
882
  * @name bitmart#fetchStatus
876
883
  * @description the latest known information on the availability of the exchange API
884
+ * @see https://developer-pro.bitmart.com/en/spot/#get-system-service-status
877
885
  * @param {object} [params] extra parameters specific to the exchange API endpoint
878
886
  * @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
879
887
  */
@@ -1156,8 +1164,9 @@ class bitmart extends bitmart$1 {
1156
1164
  /**
1157
1165
  * @method
1158
1166
  * @name bitmart#fetchMarkets
1159
- * @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
1160
1167
  * @description retrieves data on all markets for bitmart
1168
+ * @see https://developer-pro.bitmart.com/en/spot/#get-trading-pair-details-v1
1169
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
1161
1170
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1162
1171
  * @returns {object[]} an array of objects representing market data
1163
1172
  */
@@ -1173,6 +1182,7 @@ class bitmart extends bitmart$1 {
1173
1182
  * @method
1174
1183
  * @name bitmart#fetchCurrencies
1175
1184
  * @description fetches all available currencies on an exchange
1185
+ * @see https://developer-pro.bitmart.com/en/spot/#get-currency-list-v1
1176
1186
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1177
1187
  * @returns {object} an associative dictionary of currencies
1178
1188
  */
@@ -1181,8 +1191,8 @@ class bitmart extends bitmart$1 {
1181
1191
  //
1182
1192
  // {
1183
1193
  // "message": "OK",
1184
- // "code":1000,
1185
- // "trace": "9eaec51cd80d46d48a1c6b447206c4d6.71.17392193317851454",
1194
+ // "code": 1000,
1195
+ // "trace": "619294ecef584282b26a3be322b1e01f.66.17403093228242228",
1186
1196
  // "data": {
1187
1197
  // "currencies": [
1188
1198
  // {
@@ -1193,7 +1203,9 @@ class bitmart extends bitmart$1 {
1193
1203
  // "withdraw_enabled": true,
1194
1204
  // "deposit_enabled": true,
1195
1205
  // "withdraw_minsize": "0.0003",
1196
- // "withdraw_minfee": "9.74"
1206
+ // "withdraw_minfee": "9.61",
1207
+ // "withdraw_fee_estimate": "9.61",
1208
+ // "withdraw_fee": "0.0001"
1197
1209
  // }
1198
1210
  // ]
1199
1211
  // }
@@ -1240,7 +1252,7 @@ class bitmart extends bitmart$1 {
1240
1252
  'withdraw': withdraw,
1241
1253
  'deposit': deposit,
1242
1254
  'active': withdraw && deposit,
1243
- 'fee': this.safeNumber(currency, 'withdraw_minfee'),
1255
+ 'fee': this.safeNumber(currency, 'withdraw_fee'),
1244
1256
  'limits': {
1245
1257
  'withdraw': {
1246
1258
  'min': this.safeNumber(currency, 'withdraw_minsize'),
@@ -1364,6 +1376,7 @@ class bitmart extends bitmart$1 {
1364
1376
  * @method
1365
1377
  * @name bitmart#fetchDepositWithdrawFee
1366
1378
  * @description fetch the fee for deposits and withdrawals
1379
+ * @see https://developer-pro.bitmart.com/en/spot/#withdraw-quota-keyed
1367
1380
  * @param {string} code unified currency code
1368
1381
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1369
1382
  * @param {string} [params.network] the network code of the currency
@@ -1774,7 +1787,6 @@ class bitmart extends bitmart$1 {
1774
1787
  * @name bitmart#fetchOrderBook
1775
1788
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
1776
1789
  * @see https://developer-pro.bitmart.com/en/spot/#get-depth-v3
1777
- * @see https://developer-pro.bitmart.com/en/futures/#get-market-depth
1778
1790
  * @see https://developer-pro.bitmart.com/en/futuresv2/#get-market-depth
1779
1791
  * @param {string} symbol unified symbol of the market to fetch the order book for
1780
1792
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -2127,7 +2139,14 @@ class bitmart extends bitmart$1 {
2127
2139
  }
2128
2140
  let response = undefined;
2129
2141
  if (market['swap']) {
2130
- response = await this.publicGetContractPublicKline(this.extend(request, params));
2142
+ const price = this.safeString(params, 'price');
2143
+ if (price === 'mark') {
2144
+ params = this.omit(params, 'price');
2145
+ response = await this.publicGetContractPublicMarkpriceKline(this.extend(request, params));
2146
+ }
2147
+ else {
2148
+ response = await this.publicGetContractPublicKline(this.extend(request, params));
2149
+ }
2131
2150
  }
2132
2151
  else {
2133
2152
  response = await this.publicGetSpotQuotationV3Klines(this.extend(request, params));
@@ -2172,7 +2191,7 @@ class bitmart extends bitmart$1 {
2172
2191
  * @method
2173
2192
  * @name bitmart#fetchMyTrades
2174
2193
  * @see https://developer-pro.bitmart.com/en/spot/#account-trade-list-v4-signed
2175
- * @see https://developer-pro.bitmart.com/en/futures/#get-order-trade-keyed
2194
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-trade-keyed
2176
2195
  * @description fetch all trades made by the user
2177
2196
  * @param {string} symbol unified market symbol
2178
2197
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -2363,11 +2382,10 @@ class bitmart extends bitmart$1 {
2363
2382
  * @method
2364
2383
  * @name bitmart#fetchBalance
2365
2384
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
2366
- * @see https://developer-pro.bitmart.com/en/spot/#get-spot-wallet-balance
2367
- * @see https://developer-pro.bitmart.com/en/futures/#get-contract-assets-detail
2385
+ * @see https://developer-pro.bitmart.com/en/spot/#get-spot-wallet-balance-keyed
2368
2386
  * @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-assets-keyed
2369
- * @see https://developer-pro.bitmart.com/en/spot/#get-account-balance
2370
- * @see https://developer-pro.bitmart.com/en/spot/#get-margin-account-details-isolated
2387
+ * @see https://developer-pro.bitmart.com/en/spot/#get-account-balance-keyed
2388
+ * @see https://developer-pro.bitmart.com/en/spot/#get-margin-account-details-isolated-keyed
2371
2389
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2372
2390
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
2373
2391
  */
@@ -2421,8 +2439,8 @@ class bitmart extends bitmart$1 {
2421
2439
  // "trace":"5c3b7fc7-93b2-49ef-bb59-7fdc56915b59",
2422
2440
  // "data":{
2423
2441
  // "wallet":[
2424
- // {"currency":"BTC","name":"Bitcoin","available":"0.00000062","frozen":"0.00000000"},
2425
- // {"currency":"ETH","name":"Ethereum","available":"0.00002277","frozen":"0.00000000"}
2442
+ // {"currency":"BTC","name":"Bitcoin","available":"0.00000062","frozen":"0.00000000","available_usd_valuation":null},
2443
+ // {"currency":"ETH","name":"Ethereum","available":"0.00002277","frozen":"0.00000000","available_usd_valuation":null}
2426
2444
  // ]
2427
2445
  // }
2428
2446
  // }
@@ -2516,6 +2534,7 @@ class bitmart extends bitmart$1 {
2516
2534
  * @method
2517
2535
  * @name bitmart#fetchTradingFee
2518
2536
  * @description fetch the trading fees for a market
2537
+ * @see https://developer-pro.bitmart.com/en/spot/#get-actual-trade-fee-rate-keyed
2519
2538
  * @param {string} symbol unified market symbol
2520
2539
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2521
2540
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -2731,11 +2750,11 @@ class bitmart extends bitmart$1 {
2731
2750
  * @name bitmart#createOrder
2732
2751
  * @description create a trade order
2733
2752
  * @see https://developer-pro.bitmart.com/en/spot/#new-order-v2-signed
2734
- * @see https://developer-pro.bitmart.com/en/spot/#place-margin-order
2735
- * @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
2736
- * @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
2753
+ * @see https://developer-pro.bitmart.com/en/spot/#new-margin-order-v1-signed
2754
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-order-signed
2737
2755
  * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
2738
- * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-or-sl-order-signed
2756
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-sl-order-signed
2757
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-trail-order-signed
2739
2758
  * @param {string} symbol unified symbol of the market to create an order in
2740
2759
  * @param {string} type 'market', 'limit' or 'trailing' for swap markets only
2741
2760
  * @param {string} side 'buy' or 'sell'
@@ -2781,7 +2800,12 @@ class bitmart extends bitmart$1 {
2781
2800
  }
2782
2801
  else {
2783
2802
  const swapRequest = this.createSwapOrderRequest(symbol, type, side, amount, price, params);
2784
- if (isTriggerOrder) {
2803
+ const activationPrice = this.safeString(swapRequest, 'activation_price');
2804
+ if (activationPrice !== undefined) {
2805
+ // if type is trailing
2806
+ response = await this.privatePostContractPrivateSubmitTrailOrder(swapRequest);
2807
+ }
2808
+ else if (isTriggerOrder) {
2785
2809
  response = await this.privatePostContractPrivateSubmitPlanOrder(swapRequest);
2786
2810
  }
2787
2811
  else if (isStopLoss || isTakeProfit) {
@@ -2892,7 +2916,8 @@ class bitmart extends bitmart$1 {
2892
2916
  * @description create a trade order
2893
2917
  * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-order-signed
2894
2918
  * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
2895
- * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-or-sl-order-signed
2919
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-sl-order-signed
2920
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-trail-order-signed
2896
2921
  * @param {string} symbol unified symbol of the market to create an order in
2897
2922
  * @param {string} type 'market', 'limit', 'trailing', 'stop_loss', or 'take_profit'
2898
2923
  * @param {string} side 'buy' or 'sell'
@@ -2927,7 +2952,6 @@ class bitmart extends bitmart$1 {
2927
2952
  }
2928
2953
  const request = {
2929
2954
  'symbol': market['id'],
2930
- 'type': type,
2931
2955
  'size': parseInt(this.amountToPrecision(symbol, amount)),
2932
2956
  };
2933
2957
  const timeInForce = this.safeString(params, 'timeInForce');
@@ -2960,6 +2984,7 @@ class bitmart extends bitmart$1 {
2960
2984
  request['price'] = this.priceToPrecision(symbol, price);
2961
2985
  }
2962
2986
  else if (type === 'trailing' || isTrailingPercentOrder) {
2987
+ type = 'trailing';
2963
2988
  request['callback_rate'] = trailingPercent;
2964
2989
  request['activation_price'] = this.priceToPrecision(symbol, trailingTriggerPrice);
2965
2990
  request['activation_price_type'] = this.safeInteger(params, 'activation_price_type', 1);
@@ -3032,6 +3057,9 @@ class bitmart extends bitmart$1 {
3032
3057
  else if (isTriggerOrder) {
3033
3058
  request['leverage'] = '1'; // for plan orders leverage is required, if not available default to 1
3034
3059
  }
3060
+ if (type !== 'trailing') {
3061
+ request['type'] = type;
3062
+ }
3035
3063
  return this.extend(request, params);
3036
3064
  }
3037
3065
  createSpotOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
@@ -3040,8 +3068,8 @@ class bitmart extends bitmart$1 {
3040
3068
  * @name bitmart#createSpotOrderRequest
3041
3069
  * @ignore
3042
3070
  * @description create a spot order request
3043
- * @see https://developer-pro.bitmart.com/en/spot/#place-spot-order
3044
- * @see https://developer-pro.bitmart.com/en/spot/#place-margin-order
3071
+ * @see https://developer-pro.bitmart.com/en/spot/#new-order-v2-signed
3072
+ * @see https://developer-pro.bitmart.com/en/spot/#new-margin-order-v1-signed
3045
3073
  * @param {string} symbol unified symbol of the market to create an order in
3046
3074
  * @param {string} type 'market' or 'limit'
3047
3075
  * @param {string} side 'buy' or 'sell'
@@ -3117,17 +3145,17 @@ class bitmart extends bitmart$1 {
3117
3145
  * @method
3118
3146
  * @name bitmart#cancelOrder
3119
3147
  * @description cancels an open order
3120
- * @see https://developer-pro.bitmart.com/en/futures/#cancel-order-signed
3148
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-order-signed
3121
3149
  * @see https://developer-pro.bitmart.com/en/spot/#cancel-order-v3-signed
3122
- * @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
3123
- * @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
3124
- * @see https://developer-pro.bitmart.com/en/futures/#cancel-order-signed
3125
- * @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
3150
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-plan-order-signed
3151
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-order-signed
3152
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-trail-order-signed
3126
3153
  * @param {string} id order id
3127
3154
  * @param {string} symbol unified symbol of the market the order was made in
3128
3155
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3129
3156
  * @param {string} [params.clientOrderId] *spot only* the client order id of the order to cancel
3130
3157
  * @param {boolean} [params.trigger] *swap only* whether the order is a trigger order
3158
+ * @param {boolean} [params.trailing] *swap only* whether the order is a stop order
3131
3159
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3132
3160
  */
3133
3161
  async cancelOrder(id, symbol = undefined, params = {}) {
@@ -3153,12 +3181,16 @@ class bitmart extends bitmart$1 {
3153
3181
  }
3154
3182
  else {
3155
3183
  const trigger = this.safeBool2(params, 'stop', 'trigger');
3184
+ const trailing = this.safeBool(params, 'trailing');
3156
3185
  params = this.omit(params, ['stop', 'trigger']);
3157
- if (!trigger) {
3158
- response = await this.privatePostContractPrivateCancelOrder(this.extend(request, params));
3186
+ if (trigger) {
3187
+ response = await this.privatePostContractPrivateCancelPlanOrder(this.extend(request, params));
3188
+ }
3189
+ else if (trailing) {
3190
+ response = await this.privatePostContractPrivateCancelTrailOrder(this.extend(request, params));
3159
3191
  }
3160
3192
  else {
3161
- response = await this.privatePostContractPrivateCancelPlanOrder(this.extend(request, params));
3193
+ response = await this.privatePostContractPrivateCancelOrder(this.extend(request, params));
3162
3194
  }
3163
3195
  }
3164
3196
  // swap
@@ -3273,9 +3305,7 @@ class bitmart extends bitmart$1 {
3273
3305
  * @method
3274
3306
  * @name bitmart#cancelAllOrders
3275
3307
  * @description cancel all open orders in a market
3276
- * @see https://developer-pro.bitmart.com/en/spot/#cancel-all-orders
3277
- * @see https://developer-pro.bitmart.com/en/spot/#new-batch-order-v4-signed
3278
- * @see https://developer-pro.bitmart.com/en/futures/#cancel-all-orders-signed
3308
+ * @see https://developer-pro.bitmart.com/en/spot/#cancel-all-order-v4-signed
3279
3309
  * @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-all-orders-signed
3280
3310
  * @param {string} symbol unified market symbol of the market to cancel orders in
3281
3311
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3385,8 +3415,8 @@ class bitmart extends bitmart$1 {
3385
3415
  * @method
3386
3416
  * @name bitmart#fetchOpenOrders
3387
3417
  * @see https://developer-pro.bitmart.com/en/spot/#current-open-orders-v4-signed
3388
- * @see https://developer-pro.bitmart.com/en/futures/#get-all-open-orders-keyed
3389
- * @see https://developer-pro.bitmart.com/en/futures/#get-all-current-plan-orders-keyed
3418
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-all-open-orders-keyed
3419
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-all-current-plan-orders-keyed
3390
3420
  * @description fetch all unfilled currently open orders
3391
3421
  * @param {string} symbol unified market symbol
3392
3422
  * @param {int} [since] the earliest time in ms to fetch open orders for
@@ -3517,7 +3547,6 @@ class bitmart extends bitmart$1 {
3517
3547
  * @method
3518
3548
  * @name bitmart#fetchClosedOrders
3519
3549
  * @see https://developer-pro.bitmart.com/en/spot/#account-orders-v4-signed
3520
- * @see https://developer-pro.bitmart.com/en/futures/#get-order-history-keyed
3521
3550
  * @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-history-keyed
3522
3551
  * @description fetches information on multiple closed orders made by the user
3523
3552
  * @param {string} symbol unified market symbol of the market orders were made in
@@ -3587,7 +3616,6 @@ class bitmart extends bitmart$1 {
3587
3616
  * @description fetches information on an order made by the user
3588
3617
  * @see https://developer-pro.bitmart.com/en/spot/#query-order-by-id-v4-signed
3589
3618
  * @see https://developer-pro.bitmart.com/en/spot/#query-order-by-clientorderid-v4-signed
3590
- * @see https://developer-pro.bitmart.com/en/futures/#get-order-detail-keyed
3591
3619
  * @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-detail-keyed
3592
3620
  * @param {string} id the id of the order
3593
3621
  * @param {string} symbol unified symbol of the market the order was made in
@@ -3725,6 +3753,7 @@ class bitmart extends bitmart$1 {
3725
3753
  }
3726
3754
  parseDepositAddress(depositAddress, currency = undefined) {
3727
3755
  //
3756
+ // fetchDepositAddress
3728
3757
  // {
3729
3758
  // currency: 'ETH',
3730
3759
  // chain: 'Ethereum',
@@ -3732,8 +3761,19 @@ class bitmart extends bitmart$1 {
3732
3761
  // address_memo: ''
3733
3762
  // }
3734
3763
  //
3764
+ // fetchWithdrawAddress
3765
+ // {
3766
+ // "currency": "ETH",
3767
+ // "network": "ETH",
3768
+ // "address": "0x1121",
3769
+ // "memo": "12",
3770
+ // "remark": "12",
3771
+ // "addressType": 0,
3772
+ // "verifyStatus": 0
3773
+ // }
3774
+ //
3735
3775
  let currencyId = this.safeString(depositAddress, 'currency');
3736
- let network = this.safeString(depositAddress, 'chain');
3776
+ let network = this.safeString2(depositAddress, 'chain', 'network');
3737
3777
  if (currencyId.indexOf('NFT') < 0) {
3738
3778
  const parts = currencyId.split('-');
3739
3779
  currencyId = this.safeString(parts, 0);
@@ -3750,13 +3790,14 @@ class bitmart extends bitmart$1 {
3750
3790
  'currency': this.safeString(currency, 'code'),
3751
3791
  'network': this.networkIdToCode(network),
3752
3792
  'address': address,
3753
- 'tag': this.safeString(depositAddress, 'address_memo'),
3793
+ 'tag': this.safeString2(depositAddress, 'address_memo', 'memo'),
3754
3794
  };
3755
3795
  }
3756
3796
  /**
3757
3797
  * @method
3758
3798
  * @name bitmart#withdraw
3759
3799
  * @description make a withdrawal
3800
+ * @see https://developer-pro.bitmart.com/en/spot/#withdraw-signed
3760
3801
  * @param {string} code unified currency code
3761
3802
  * @param {float} amount the amount to withdraw
3762
3803
  * @param {string} address the address to withdraw to
@@ -3803,11 +3844,10 @@ class bitmart extends bitmart$1 {
3803
3844
  async fetchTransactionsByType(type, code = undefined, since = undefined, limit = undefined, params = {}) {
3804
3845
  await this.loadMarkets();
3805
3846
  if (limit === undefined) {
3806
- limit = 50; // max 50
3847
+ limit = 1000; // max 1000
3807
3848
  }
3808
3849
  const request = {
3809
3850
  'operation_type': type,
3810
- 'offset': 1,
3811
3851
  'N': limit,
3812
3852
  };
3813
3853
  let currency = undefined;
@@ -3815,6 +3855,14 @@ class bitmart extends bitmart$1 {
3815
3855
  currency = this.currency(code);
3816
3856
  request['currency'] = currency['id'];
3817
3857
  }
3858
+ if (since !== undefined) {
3859
+ request['startTime'] = since;
3860
+ }
3861
+ const until = this.safeInteger(params, 'until');
3862
+ if (until !== undefined) {
3863
+ params = this.omit(params, 'until');
3864
+ request['endTime'] = until;
3865
+ }
3818
3866
  const response = await this.privateGetAccountV2DepositWithdrawHistory(this.extend(request, params));
3819
3867
  //
3820
3868
  // {
@@ -3848,6 +3896,7 @@ class bitmart extends bitmart$1 {
3848
3896
  * @method
3849
3897
  * @name bitmart#fetchDeposit
3850
3898
  * @description fetch information on a deposit
3899
+ * @see https://developer-pro.bitmart.com/en/spot/#get-a-deposit-or-withdraw-detail-keyed
3851
3900
  * @param {string} id deposit id
3852
3901
  * @param {string} code not used by bitmart fetchDeposit ()
3853
3902
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3889,6 +3938,7 @@ class bitmart extends bitmart$1 {
3889
3938
  * @method
3890
3939
  * @name bitmart#fetchDeposits
3891
3940
  * @description fetch all deposits made to an account
3941
+ * @see https://developer-pro.bitmart.com/en/spot/#get-deposit-and-withdraw-history-keyed
3892
3942
  * @param {string} code unified currency code
3893
3943
  * @param {int} [since] the earliest time in ms to fetch deposits for
3894
3944
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -3902,6 +3952,7 @@ class bitmart extends bitmart$1 {
3902
3952
  * @method
3903
3953
  * @name bitmart#fetchWithdrawal
3904
3954
  * @description fetch data on a currency withdrawal via the withdrawal id
3955
+ * @see https://developer-pro.bitmart.com/en/spot/#get-a-deposit-or-withdraw-detail-keyed
3905
3956
  * @param {string} id withdrawal id
3906
3957
  * @param {string} code not used by bitmart.fetchWithdrawal
3907
3958
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3943,6 +3994,7 @@ class bitmart extends bitmart$1 {
3943
3994
  * @method
3944
3995
  * @name bitmart#fetchWithdrawals
3945
3996
  * @description fetch all withdrawals made from an account
3997
+ * @see https://developer-pro.bitmart.com/en/spot/#get-deposit-and-withdraw-history-keyed
3946
3998
  * @param {string} code unified currency code
3947
3999
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
3948
4000
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -4048,7 +4100,7 @@ class bitmart extends bitmart$1 {
4048
4100
  * @method
4049
4101
  * @name bitmart#repayIsolatedMargin
4050
4102
  * @description repay borrowed margin and interest
4051
- * @see https://developer-pro.bitmart.com/en/spot/#margin-repay-isolated
4103
+ * @see https://developer-pro.bitmart.com/en/spot/#margin-repay-isolated-signed
4052
4104
  * @param {string} symbol unified market symbol
4053
4105
  * @param {string} code unified currency code of the currency to repay
4054
4106
  * @param {string} amount the amount to repay
@@ -4086,7 +4138,7 @@ class bitmart extends bitmart$1 {
4086
4138
  * @method
4087
4139
  * @name bitmart#borrowIsolatedMargin
4088
4140
  * @description create a loan to borrow margin
4089
- * @see https://developer-pro.bitmart.com/en/spot/#margin-borrow-isolated
4141
+ * @see https://developer-pro.bitmart.com/en/spot/#margin-borrow-isolated-signed
4090
4142
  * @param {string} symbol unified market symbol
4091
4143
  * @param {string} code unified currency code of the currency to borrow
4092
4144
  * @param {string} amount the amount to borrow
@@ -4291,7 +4343,6 @@ class bitmart extends bitmart$1 {
4291
4343
  * @name bitmart#transfer
4292
4344
  * @description transfer currency internally between wallets on the same account, currently only supports transfer between spot and margin
4293
4345
  * @see https://developer-pro.bitmart.com/en/spot/#margin-asset-transfer-signed
4294
- * @see https://developer-pro.bitmart.com/en/futures/#transfer-signed
4295
4346
  * @see https://developer-pro.bitmart.com/en/futuresv2/#transfer-signed
4296
4347
  * @param {string} code unified currency code
4297
4348
  * @param {float} amount amount to transfer
@@ -4432,7 +4483,7 @@ class bitmart extends bitmart$1 {
4432
4483
  * @method
4433
4484
  * @name bitmart#fetchTransfers
4434
4485
  * @description fetch a history of internal transfers made on an account, only transfers between spot and swap are supported
4435
- * @see https://developer-pro.bitmart.com/en/futures/#get-transfer-list-signed
4486
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-transfer-list-signed
4436
4487
  * @param {string} code unified currency code of the currency transferred
4437
4488
  * @param {int} [since] the earliest time in ms to fetch transfers for
4438
4489
  * @param {int} [limit] the maximum number of transfer structures to retrieve
@@ -4495,7 +4546,7 @@ class bitmart extends bitmart$1 {
4495
4546
  * @method
4496
4547
  * @name bitmart#fetchBorrowInterest
4497
4548
  * @description fetch the interest owed by the user for borrowing currency for margin trading
4498
- * @see https://developer-pro.bitmart.com/en/spot/#get-borrow-record-isolated
4549
+ * @see https://developer-pro.bitmart.com/en/spot/#get-borrow-record-isolated-keyed
4499
4550
  * @param {string} code unified currency code
4500
4551
  * @param {string} symbol unified market symbol when fetch interest in isolated markets
4501
4552
  * @param {int} [since] the earliest time in ms to fetch borrrow interest for
@@ -4632,7 +4683,6 @@ class bitmart extends bitmart$1 {
4632
4683
  * @method
4633
4684
  * @name bitmart#setLeverage
4634
4685
  * @description set the level of leverage for a market
4635
- * @see https://developer-pro.bitmart.com/en/futures/#submit-leverage-signed
4636
4686
  * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-leverage-signed
4637
4687
  * @param {float} leverage the rate of leverage
4638
4688
  * @param {string} symbol unified market symbol
@@ -4789,8 +4839,7 @@ class bitmart extends bitmart$1 {
4789
4839
  * @method
4790
4840
  * @name bitmart#fetchPosition
4791
4841
  * @description fetch data on a single open contract trade position
4792
- * @see https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
4793
- * @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
4842
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-keyed
4794
4843
  * @param {string} symbol unified market symbol of the market the position is held in
4795
4844
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4796
4845
  * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
@@ -4839,8 +4888,7 @@ class bitmart extends bitmart$1 {
4839
4888
  * @method
4840
4889
  * @name bitmart#fetchPositions
4841
4890
  * @description fetch all open contract positions
4842
- * @see https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
4843
- * @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
4891
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-keyed
4844
4892
  * @param {string[]|undefined} symbols list of unified market symbols
4845
4893
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4846
4894
  * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
@@ -4965,7 +5013,7 @@ class bitmart extends bitmart$1 {
4965
5013
  * @method
4966
5014
  * @name bitmart#fetchMyLiquidations
4967
5015
  * @description retrieves the users liquidated positions
4968
- * @see https://developer-pro.bitmart.com/en/futures/#get-order-history-keyed
5016
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-history-keyed
4969
5017
  * @param {string} symbol unified CCXT market symbol
4970
5018
  * @param {int} [since] the earliest time in ms to fetch liquidations for
4971
5019
  * @param {int} [limit] the maximum number of liquidation structures to retrieve
@@ -5379,6 +5427,49 @@ class bitmart extends bitmart$1 {
5379
5427
  const sorted = this.sortBy(result, 'timestamp');
5380
5428
  return this.filterBySinceLimit(sorted, since, limit);
5381
5429
  }
5430
+ async fetchWithdrawAddresses(code, note = undefined, networkCode = undefined, params = {}) {
5431
+ await this.loadMarkets();
5432
+ let codes = undefined;
5433
+ if (code !== undefined) {
5434
+ const currency = this.currency(code);
5435
+ code = currency['code'];
5436
+ codes = [code];
5437
+ }
5438
+ const response = await this.privateGetAccountV1WithdrawAddressList(params);
5439
+ //
5440
+ // {
5441
+ // "message": "OK",
5442
+ // "code": 1000,
5443
+ // "trace": "0e6edd79-f77f-4251-abe5-83ba75d06c1a",
5444
+ // "data": {
5445
+ // "list": [
5446
+ // {
5447
+ // "currency": "ETH",
5448
+ // "network": "ETH",
5449
+ // "address": "0x1121",
5450
+ // "memo": "12",
5451
+ // "remark": "12",
5452
+ // "addressType": 0,
5453
+ // "verifyStatus": 0
5454
+ // }
5455
+ // ]
5456
+ // }
5457
+ // }
5458
+ //
5459
+ const data = this.safeDict(response, 'data', {});
5460
+ const list = this.safeList(data, 'list', []);
5461
+ const allAddresses = this.parseDepositAddresses(list, codes, false);
5462
+ const addresses = [];
5463
+ for (let i = 0; i < allAddresses.length; i++) {
5464
+ const address = allAddresses[i];
5465
+ const noteMatch = (note === undefined) || (address['note'] === note);
5466
+ const networkMatch = (networkCode === undefined) || (address['network'] === networkCode);
5467
+ if (noteMatch && networkMatch) {
5468
+ addresses.push(address);
5469
+ }
5470
+ }
5471
+ return addresses;
5472
+ }
5382
5473
  nonce() {
5383
5474
  return this.milliseconds() - this.options['timeDifference'];
5384
5475
  }
@@ -1334,7 +1334,7 @@ class bybit extends bybit$1 {
1334
1334
  // so we're assuming UTA is enabled
1335
1335
  this.options['enableUnifiedMargin'] = false;
1336
1336
  this.options['enableUnifiedAccount'] = true;
1337
- this.options['unifiedMarginStatus'] = 3;
1337
+ this.options['unifiedMarginStatus'] = 6;
1338
1338
  return [this.options['enableUnifiedMargin'], this.options['enableUnifiedAccount']];
1339
1339
  }
1340
1340
  const rawPromises = [this.privateGetV5UserQueryApi(params), this.privateGetV5AccountInfo(params)];
@@ -1400,7 +1400,7 @@ class bybit extends bybit$1 {
1400
1400
  const accountResult = this.safeDict(accountInfo, 'result', {});
1401
1401
  this.options['enableUnifiedMargin'] = this.safeInteger(result, 'unified') === 1;
1402
1402
  this.options['enableUnifiedAccount'] = this.safeInteger(result, 'uta') === 1;
1403
- this.options['unifiedMarginStatus'] = this.safeInteger(accountResult, 'unifiedMarginStatus', 3); // default to uta.1 if not found
1403
+ this.options['unifiedMarginStatus'] = this.safeInteger(accountResult, 'unifiedMarginStatus', 6); // default to uta 2.0 pro if not found
1404
1404
  }
1405
1405
  return [this.options['enableUnifiedMargin'], this.options['enableUnifiedAccount']];
1406
1406
  }
@@ -3434,7 +3434,7 @@ class bybit extends bybit$1 {
3434
3434
  const isInverse = (type === 'inverse');
3435
3435
  const isFunding = (lowercaseRawType === 'fund') || (lowercaseRawType === 'funding');
3436
3436
  if (isUnifiedAccount) {
3437
- const unifiedMarginStatus = this.safeInteger(this.options, 'unifiedMarginStatus', 3);
3437
+ const unifiedMarginStatus = this.safeInteger(this.options, 'unifiedMarginStatus', 6);
3438
3438
  if (unifiedMarginStatus < 5) {
3439
3439
  // it's not uta.20 where inverse are unified
3440
3440
  if (isInverse) {
@@ -4232,7 +4232,7 @@ class bybit extends bybit$1 {
4232
4232
  }
4233
4233
  const symbols = this.marketSymbols(orderSymbols, undefined, false, true, true);
4234
4234
  const market = this.market(symbols[0]);
4235
- const unifiedMarginStatus = this.safeInteger(this.options, 'unifiedMarginStatus', 3);
4235
+ const unifiedMarginStatus = this.safeInteger(this.options, 'unifiedMarginStatus', 6);
4236
4236
  let category = undefined;
4237
4237
  [category, params] = this.getBybitType('createOrders', market, params);
4238
4238
  if ((category === 'inverse') && (unifiedMarginStatus < 5)) {
@@ -4448,7 +4448,7 @@ class bybit extends bybit$1 {
4448
4448
  }
4449
4449
  orderSymbols = this.marketSymbols(orderSymbols, undefined, false, true, true);
4450
4450
  const market = this.market(orderSymbols[0]);
4451
- const unifiedMarginStatus = this.safeInteger(this.options, 'unifiedMarginStatus', 3);
4451
+ const unifiedMarginStatus = this.safeInteger(this.options, 'unifiedMarginStatus', 6);
4452
4452
  let category = undefined;
4453
4453
  [category, params] = this.getBybitType('editOrders', market, params);
4454
4454
  if ((category === 'inverse') && (unifiedMarginStatus < 5)) {