ccxt 4.0.102 → 4.0.103

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.
package/js/ccxt.d.ts CHANGED
@@ -3,8 +3,8 @@ import { Precise } from './src/base/Precise.js';
3
3
  import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position } from './src/base/types.js';
6
- import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending } from './src/base/errors.js';
7
- declare const version = "4.0.101";
6
+ import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
+ declare const version = "4.0.102";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
@@ -510,5 +510,5 @@ declare const ccxt: {
510
510
  zaif: typeof zaif;
511
511
  zonda: typeof zonda;
512
512
  } & typeof functions & typeof errors;
513
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitforex, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitstamp1, bittrex, bitvavo, bl3p, blockchaincom, btcalpha, btcbox, btcmarkets, btctradeua, btcturk, bybit, cex, coinbase, coinbaseprime, coinbasepro, coincheck, coinex, coinfalcon, coinmate, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, huobi, huobijp, huobipro, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, lbank2, luno, lykke, mercado, mexc, mexc3, ndax, novadax, oceanex, okcoin, okex, okex5, okx, paymium, phemex, poloniex, poloniexfutures, probit, tidex, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
513
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitforex, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitstamp1, bittrex, bitvavo, bl3p, blockchaincom, btcalpha, btcbox, btcmarkets, btctradeua, btcturk, bybit, cex, coinbase, coinbaseprime, coinbasepro, coincheck, coinex, coinfalcon, coinmate, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, huobi, huobijp, huobipro, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, lbank2, luno, lykke, mercado, mexc, mexc3, ndax, novadax, oceanex, okcoin, okex, okex5, okx, paymium, phemex, poloniex, poloniexfutures, probit, tidex, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
514
514
  export default ccxt;
package/js/ccxt.js CHANGED
@@ -35,10 +35,10 @@ import { Exchange } from './src/base/Exchange.js';
35
35
  import { Precise } from './src/base/Precise.js';
36
36
  import * as functions from './src/base/functions.js';
37
37
  import * as errors from './src/base/errors.js';
38
- import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending } from './src/base/errors.js';
38
+ import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.0.102';
41
+ const version = '4.0.103';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -386,6 +386,6 @@ pro.exchanges = Object.keys(pro);
386
386
  pro['Exchange'] = Exchange; // now the same for rest and ts
387
387
  //-----------------------------------------------------------------------------
388
388
  const ccxt = Object.assign({ version, Exchange, Precise, 'exchanges': Object.keys(exchanges), 'pro': pro }, exchanges, functions, errors);
389
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitforex, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitstamp1, bittrex, bitvavo, bl3p, blockchaincom, btcalpha, btcbox, btcmarkets, btctradeua, btcturk, bybit, cex, coinbase, coinbaseprime, coinbasepro, coincheck, coinex, coinfalcon, coinmate, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, huobi, huobijp, huobipro, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, lbank2, luno, lykke, mercado, mexc, mexc3, ndax, novadax, oceanex, okcoin, okex, okex5, okx, paymium, phemex, poloniex, poloniexfutures, probit, tidex, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
389
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitforex, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitstamp1, bittrex, bitvavo, bl3p, blockchaincom, btcalpha, btcbox, btcmarkets, btctradeua, btcturk, bybit, cex, coinbase, coinbaseprime, coinbasepro, coincheck, coinex, coinfalcon, coinmate, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, huobi, huobijp, huobipro, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, lbank2, luno, lykke, mercado, mexc, mexc3, ndax, novadax, oceanex, okcoin, okex, okex5, okx, paymium, phemex, poloniex, poloniexfutures, probit, tidex, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
390
390
  export default ccxt;
391
391
  //-----------------------------------------------------------------------------
@@ -11,6 +11,7 @@ declare const errorHierarchy: {
11
11
  BadRequest: {
12
12
  BadSymbol: {};
13
13
  MarginModeAlreadySet: {};
14
+ NoChange: {};
14
15
  };
15
16
  BadResponse: {
16
17
  NullResponse: {};
@@ -17,6 +17,7 @@ const errorHierarchy = {
17
17
  'BadRequest': {
18
18
  'BadSymbol': {},
19
19
  'MarginModeAlreadySet': {},
20
+ 'NoChange': {},
20
21
  },
21
22
  'BadResponse': {
22
23
  'NullResponse': {},
@@ -126,6 +126,7 @@ declare const errors: {
126
126
  AuthenticationError: typeof AuthenticationError;
127
127
  AddressPending: typeof AddressPending;
128
128
  ContractUnavailable: typeof ContractUnavailable;
129
+ NoChange: typeof NoChange;
129
130
  };
130
- export { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, ContractUnavailable };
131
+ export { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, ContractUnavailable, NoChange };
131
132
  export default errors;
@@ -236,6 +236,6 @@ class RequestTimeout extends NetworkError {
236
236
  // // Derived class hierarchy
237
237
  // errorHierarchy
238
238
  // )
239
- const errors = { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, ContractUnavailable };
240
- export { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, ContractUnavailable };
239
+ const errors = { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, ContractUnavailable, NoChange };
240
+ export { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, ContractUnavailable, NoChange };
241
241
  export default errors;
package/js/src/bingx.d.ts CHANGED
@@ -158,6 +158,14 @@ export default class bingx extends Exchange {
158
158
  toAccount: string;
159
159
  status: string;
160
160
  };
161
+ fetchDepositAddress(code: string, params?: {}): Promise<{}>;
162
+ parseDepositAddress(depositAddress: any, currency?: any): {
163
+ currency: any;
164
+ address: string;
165
+ tag: string;
166
+ network: string;
167
+ info: any;
168
+ };
161
169
  fetchDeposits(code?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
162
170
  fetchWithdrawals(code?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
163
171
  parseTransaction(transaction: any, currency?: any): {
package/js/src/bingx.js CHANGED
@@ -36,6 +36,7 @@ export default class bingx extends Exchange {
36
36
  'fetchBalance': true,
37
37
  'fetchClosedOrders': true,
38
38
  'fetchCurrencies': true,
39
+ 'fetchDepositAddress': true,
39
40
  'fetchDeposits': true,
40
41
  'fetchDepositWithdrawFee': 'emulated',
41
42
  'fetchDepositWithdrawFees': true,
@@ -322,6 +323,7 @@ export default class bingx extends Exchange {
322
323
  'PFUTURES': 'swap',
323
324
  'SFUTURES': 'future',
324
325
  },
326
+ 'recvWindow': 5 * 1000, // 5 sec
325
327
  },
326
328
  });
327
329
  }
@@ -2382,6 +2384,74 @@ export default class bingx extends Exchange {
2382
2384
  'status': status,
2383
2385
  };
2384
2386
  }
2387
+ async fetchDepositAddress(code, params = {}) {
2388
+ /**
2389
+ * @method
2390
+ * @name bingx#fetchDepositAddress
2391
+ * @description fetch the deposit address for a currency associated with this account
2392
+ * @see https://bingx-api.github.io/docs/#/common/sub-account#Query%20Main%20Account%20Deposit%20Address
2393
+ * @param {string} code unified currency code
2394
+ * @param {object} [params] extra parameters specific to the bingx api endpoint
2395
+ * @returns {object} an [address structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#address-structure}
2396
+ */
2397
+ await this.loadMarkets();
2398
+ const currency = this.currency(code);
2399
+ const defaultRecvWindow = this.safeInteger(this.options, 'recvWindow');
2400
+ const recvWindow = this.safeInteger(this.parseParams, 'recvWindow', defaultRecvWindow);
2401
+ const request = {
2402
+ 'coin': currency['id'],
2403
+ 'offset': 0,
2404
+ 'limit': 1000,
2405
+ 'recvWindow': recvWindow,
2406
+ };
2407
+ const response = await this.walletsV1PrivateGetCapitalDepositAddress(this.extend(request, params));
2408
+ //
2409
+ // {
2410
+ // code: '0',
2411
+ // timestamp: '1695200226859',
2412
+ // data: {
2413
+ // data: [
2414
+ // {
2415
+ // coinId: '799',
2416
+ // coin: 'USDT',
2417
+ // network: 'BEP20',
2418
+ // address: '6a7eda2817462dabb6493277a2cfe0f5c3f2550b',
2419
+ // tag: ''
2420
+ // }
2421
+ // ],
2422
+ // total: '1'
2423
+ // }
2424
+ // }
2425
+ //
2426
+ const data = this.safeValue(this.safeValue(response, 'data'), 'data');
2427
+ const parsed = this.parseDepositAddresses(data, [currency['code']], false);
2428
+ return this.indexBy(parsed, 'network');
2429
+ }
2430
+ parseDepositAddress(depositAddress, currency = undefined) {
2431
+ //
2432
+ // {
2433
+ // coinId: '799',
2434
+ // coin: 'USDT',
2435
+ // network: 'BEP20',
2436
+ // address: '6a7eda2817462dabb6493277a2cfe0f5c3f2550b',
2437
+ // tag: ''
2438
+ // }
2439
+ //
2440
+ const address = this.safeString(depositAddress, 'address');
2441
+ const tag = this.safeString(depositAddress, 'tag');
2442
+ const currencyId = this.safeString(depositAddress, 'coin');
2443
+ currency = this.safeCurrency(currencyId, currency);
2444
+ const code = currency['code'];
2445
+ const network = this.safeString(depositAddress, 'network');
2446
+ this.checkAddress(address);
2447
+ return {
2448
+ 'currency': code,
2449
+ 'address': address,
2450
+ 'tag': tag,
2451
+ 'network': network,
2452
+ 'info': depositAddress,
2453
+ };
2454
+ }
2385
2455
  async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
2386
2456
  /**
2387
2457
  * @method
package/js/src/bitget.js CHANGED
@@ -2569,6 +2569,9 @@ export default class bitget extends Exchange {
2569
2569
  response = await this.publicMixGetMarketHistoryCandles(this.extend(request, params));
2570
2570
  }
2571
2571
  }
2572
+ if (response === '') {
2573
+ return []; // happens when a new token is listed
2574
+ }
2572
2575
  // [ ["1645911960000","39406","39407","39374.5","39379","35.526","1399132.341"] ]
2573
2576
  const data = this.safeValue(response, 'data', response);
2574
2577
  return this.parseOHLCVs(data, market, timeframe, since, limit);
@@ -186,16 +186,19 @@ export default class bitmart extends Exchange {
186
186
  parseBorrowRates(info: any, codeKey: any): any[];
187
187
  transfer(code: string, amount: any, fromAccount: any, toAccount: any, params?: {}): Promise<any>;
188
188
  parseTransferStatus(status: any): string;
189
+ parseTransferToAccount(type: any): string;
190
+ parseTransferFromAccount(type: any): string;
189
191
  parseTransfer(transfer: any, currency?: any): {
190
192
  id: string;
191
- timestamp: any;
192
- datetime: any;
193
+ timestamp: number;
194
+ datetime: string;
193
195
  currency: any;
194
- amount: any;
195
- fromAccount: any;
196
- toAccount: any;
196
+ amount: number;
197
+ fromAccount: string;
198
+ toAccount: string;
197
199
  status: string;
198
200
  };
201
+ fetchTransfers(code?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
199
202
  fetchBorrowInterest(code?: string, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
200
203
  parseBorrowInterest(info: any, market?: any): {
201
204
  symbol: string;
package/js/src/bitmart.js CHANGED
@@ -85,7 +85,7 @@ export default class bitmart extends Exchange {
85
85
  'fetchTransactionFee': true,
86
86
  'fetchTransactionFees': false,
87
87
  'fetchTransfer': false,
88
- 'fetchTransfers': false,
88
+ 'fetchTransfers': true,
89
89
  'fetchWithdrawAddressesByNetwork': false,
90
90
  'fetchWithdrawal': true,
91
91
  'fetchWithdrawals': true,
@@ -569,6 +569,7 @@ export default class bitmart extends Exchange {
569
569
  },
570
570
  'accountsByType': {
571
571
  'spot': 'spot',
572
+ 'swap': 'swap',
572
573
  },
573
574
  'createMarketBuyOrderRequiresPrice': true,
574
575
  },
@@ -1228,6 +1229,8 @@ export default class bitmart extends Exchange {
1228
1229
  * @method
1229
1230
  * @name bitmart#fetchOrderBook
1230
1231
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
1232
+ * @see https://developer-pro.bitmart.com/en/spot/#get-depth-v3
1233
+ * @see https://developer-pro.bitmart.com/en/futures/#get-market-depth
1231
1234
  * @param {string} symbol unified symbol of the market to fetch the order book for
1232
1235
  * @param {int} [limit] the maximum amount of order book entries to return
1233
1236
  * @param {object} [params] extra parameters specific to the bitmart api endpoint
@@ -1235,41 +1238,70 @@ export default class bitmart extends Exchange {
1235
1238
  */
1236
1239
  await this.loadMarkets();
1237
1240
  const market = this.market(symbol);
1238
- if (!market['spot']) {
1239
- throw new NotSupported(this.id + ' fetchOrderBook() does not support ' + market['type'] + ' markets, only spot markets are accepted');
1240
- }
1241
1241
  const request = {
1242
1242
  'symbol': market['id'],
1243
1243
  };
1244
- if (limit !== undefined) {
1245
- request['size'] = limit; // default 50, max 200
1244
+ let response = undefined;
1245
+ if (market['spot']) {
1246
+ if (limit !== undefined) {
1247
+ request['limit'] = limit; // default 35, max 50
1248
+ }
1249
+ response = await this.publicGetSpotQuotationV3Books(this.extend(request, params));
1250
+ }
1251
+ else if (market['swap']) {
1252
+ response = await this.publicGetContractPublicDepth(this.extend(request, params));
1253
+ }
1254
+ else {
1255
+ throw new NotSupported(this.id + ' fetchOrderBook() does not support ' + market['type'] + ' markets, only spot and swap markets are accepted');
1246
1256
  }
1247
- // request['precision'] = 4; // optional price precision / depth level whose range is defined in symbol details
1248
- const response = await this.publicGetSpotV1SymbolsBook(this.extend(request, params));
1249
1257
  //
1250
1258
  // spot
1251
1259
  //
1252
1260
  // {
1253
- // "message":"OK",
1254
- // "code":1000,
1255
- // "trace":"8254f8fc-431d-404f-ad9a-e716339f66c7",
1256
- // "data":{
1257
- // "buys":[
1258
- // {"amount":"4.7091","total":"4.71","price":"0.034047","count":"1"},
1259
- // {"amount":"5.7439","total":"10.45","price":"0.034039","count":"1"},
1260
- // {"amount":"2.5249","total":"12.98","price":"0.032937","count":"1"},
1261
+ // "code": 1000,
1262
+ // "message": "success",
1263
+ // "data": {
1264
+ // "ts": "1695264191808",
1265
+ // "symbol": "BTC_USDT",
1266
+ // "asks": [
1267
+ // ["26942.57","0.06492"],
1268
+ // ["26942.73","0.05447"],
1269
+ // ["26943.00","0.07154"]
1261
1270
  // ],
1262
- // "sells":[
1263
- // {"amount":"41.4365","total":"41.44","price":"0.034174","count":"1"},
1264
- // {"amount":"4.2317","total":"45.67","price":"0.034183","count":"1"},
1265
- // {"amount":"0.3000","total":"45.97","price":"0.034240","count":"1"},
1271
+ // "bids": [
1272
+ // ["26942.45","0.00074"],
1273
+ // ["26941.53","0.00371"],
1274
+ // ["26940.94","0.08992"]
1266
1275
  // ]
1267
- // }
1276
+ // },
1277
+ // "trace": "430a7f69581d4258a8e4b424dfb10782.73.16952341919017619"
1278
+ // }
1279
+ //
1280
+ // swap
1281
+ //
1282
+ // {
1283
+ // "code": 1000,
1284
+ // "message": "Ok",
1285
+ // "data": {
1286
+ // "asks": [
1287
+ // ["26938.3","3499","3499"],
1288
+ // ["26938.5","14702","18201"],
1289
+ // ["26938.6","20457","38658"]
1290
+ // ],
1291
+ // "bids": [
1292
+ // ["26938.2","20","20"],
1293
+ // ["26937.9","1913","1933"],
1294
+ // ["26937.8","2588","4521"]
1295
+ // ],
1296
+ // "timestamp": 1695264383999,
1297
+ // "symbol": "BTCUSDT"
1298
+ // },
1299
+ // "trace": "4cad855074664097ac6ba5258c47305d.72.16952643834721135"
1268
1300
  // }
1269
1301
  //
1270
1302
  const data = this.safeValue(response, 'data', {});
1271
- const timestamp = this.safeInteger(data, 'timestamp');
1272
- return this.parseOrderBook(data, symbol, timestamp, 'buys', 'sells', 'price', 'amount');
1303
+ const timestamp = this.safeInteger2(data, 'ts', 'timestamp');
1304
+ return this.parseOrderBook(data, market['symbol'], timestamp);
1273
1305
  }
1274
1306
  parseTrade(trade, market = undefined) {
1275
1307
  //
@@ -3016,7 +3048,8 @@ export default class bitmart extends Exchange {
3016
3048
  * @method
3017
3049
  * @name bitmart#transfer
3018
3050
  * @description transfer currency internally between wallets on the same account, currently only supports transfer between spot and margin
3019
- * @see https://developer-pro.bitmart.com/en/spot/#margin-asset-transfer
3051
+ * @see https://developer-pro.bitmart.com/en/spot/#margin-asset-transfer-signed
3052
+ * @see https://developer-pro.bitmart.com/en/futures/#transfer-signed
3020
3053
  * @param {string} code unified currency code
3021
3054
  * @param {float} amount amount to transfer
3022
3055
  * @param {string} fromAccount account to transfer from
@@ -3034,17 +3067,35 @@ export default class bitmart extends Exchange {
3034
3067
  const fromId = this.convertTypeToAccount(fromAccount);
3035
3068
  const toId = this.convertTypeToAccount(toAccount);
3036
3069
  if (fromAccount === 'spot') {
3037
- request['side'] = 'in';
3038
- request['symbol'] = toId;
3070
+ if (toAccount === 'margin') {
3071
+ request['side'] = 'in';
3072
+ request['symbol'] = toId;
3073
+ }
3074
+ else if (toAccount === 'swap') {
3075
+ request['type'] = 'spot_to_contract';
3076
+ }
3039
3077
  }
3040
3078
  else if (toAccount === 'spot') {
3041
- request['side'] = 'out';
3042
- request['symbol'] = fromId;
3079
+ if (fromAccount === 'margin') {
3080
+ request['side'] = 'out';
3081
+ request['symbol'] = fromId;
3082
+ }
3083
+ else if (fromAccount === 'swap') {
3084
+ request['type'] = 'contract_to_spot';
3085
+ }
3043
3086
  }
3044
3087
  else {
3045
3088
  throw new ArgumentsRequired(this.id + ' transfer() requires either fromAccount or toAccount to be spot');
3046
3089
  }
3047
- const response = await this.privatePostSpotV1MarginIsolatedTransfer(this.extend(request, params));
3090
+ let response = undefined;
3091
+ if ((fromAccount === 'margin') || (toAccount === 'margin')) {
3092
+ response = await this.privatePostSpotV1MarginIsolatedTransfer(this.extend(request, params));
3093
+ }
3094
+ else if ((fromAccount === 'swap') || (toAccount === 'swap')) {
3095
+ response = await this.privatePostAccountV1TransferContract(this.extend(request, params));
3096
+ }
3097
+ //
3098
+ // margin
3048
3099
  //
3049
3100
  // {
3050
3101
  // "message": "OK",
@@ -3055,41 +3106,146 @@ export default class bitmart extends Exchange {
3055
3106
  // }
3056
3107
  // }
3057
3108
  //
3058
- return this.extend(this.parseTransfer(response, currency), {
3059
- 'amount': this.parseNumber(amountToPrecision),
3060
- 'fromAccount': fromAccount,
3061
- 'toAccount': toAccount,
3109
+ // swap
3110
+ //
3111
+ // {
3112
+ // "message": "OK",
3113
+ // "code": 1000,
3114
+ // "trace": "4cad858074667097ac6ba5257c57305d.68.16953302431189455",
3115
+ // "data": {
3116
+ // "currency": "USDT",
3117
+ // "amount": "5"
3118
+ // }
3119
+ // }
3120
+ //
3121
+ const data = this.safeValue(response, 'data', {});
3122
+ return this.extend(this.parseTransfer(data, currency), {
3123
+ 'status': this.parseTransferStatus(this.safeString2(response, 'code', 'message')),
3062
3124
  });
3063
3125
  }
3064
3126
  parseTransferStatus(status) {
3065
3127
  const statuses = {
3066
3128
  '1000': 'ok',
3067
3129
  'OK': 'ok',
3130
+ 'FINISHED': 'ok',
3068
3131
  };
3069
3132
  return this.safeString(statuses, status, status);
3070
3133
  }
3134
+ parseTransferToAccount(type) {
3135
+ const types = {
3136
+ 'contract_to_spot': 'spot',
3137
+ 'spot_to_contract': 'swap',
3138
+ };
3139
+ return this.safeString(types, type, type);
3140
+ }
3141
+ parseTransferFromAccount(type) {
3142
+ const types = {
3143
+ 'contract_to_spot': 'swap',
3144
+ 'spot_to_contract': 'spot',
3145
+ };
3146
+ return this.safeString(types, type, type);
3147
+ }
3071
3148
  parseTransfer(transfer, currency = undefined) {
3149
+ //
3150
+ // margin
3151
+ //
3152
+ // {
3153
+ // "transfer_id": "ca90d97a621e47d49774f19af6b029f5"
3154
+ // }
3155
+ //
3156
+ // swap
3157
+ //
3158
+ // {
3159
+ // "currency": "USDT",
3160
+ // "amount": "5"
3161
+ // }
3162
+ //
3163
+ // fetchTransfers
3164
+ //
3165
+ // {
3166
+ // "transfer_id": "902463535961567232",
3167
+ // "currency": "USDT",
3168
+ // "amount": "5",
3169
+ // "type": "contract_to_spot",
3170
+ // "state": "FINISHED",
3171
+ // "timestamp": 1695330539565
3172
+ // }
3173
+ //
3174
+ const currencyId = this.safeString(transfer, 'currency');
3175
+ const timestamp = this.safeInteger(transfer, 'timestamp');
3176
+ return {
3177
+ 'id': this.safeString(transfer, 'transfer_id'),
3178
+ 'timestamp': timestamp,
3179
+ 'datetime': this.iso8601(timestamp),
3180
+ 'currency': this.safeCurrencyCode(currencyId, currency),
3181
+ 'amount': this.safeNumber(transfer, 'amount'),
3182
+ 'fromAccount': this.parseTransferFromAccount(this.safeString(transfer, 'type')),
3183
+ 'toAccount': this.parseTransferToAccount(this.safeString(transfer, 'type')),
3184
+ 'status': this.parseTransferStatus(this.safeString(transfer, 'state')),
3185
+ };
3186
+ }
3187
+ async fetchTransfers(code = undefined, since = undefined, limit = undefined, params = {}) {
3188
+ /**
3189
+ * @method
3190
+ * @name bitmart#fetchTransfers
3191
+ * @description fetch a history of internal transfers made on an account, only transfers between spot and swap are supported
3192
+ * @see https://developer-pro.bitmart.com/en/futures/#get-transfer-list-signed
3193
+ * @param {string} code unified currency code of the currency transferred
3194
+ * @param {int} [since] the earliest time in ms to fetch transfers for
3195
+ * @param {int} [limit] the maximum number of transfer structures to retrieve
3196
+ * @param {object} [params] extra parameters specific to the bitmart api endpoint
3197
+ * @param {int} [params.page] the required number of pages, default is 1, max is 1000
3198
+ * @param {int} [params.until] the latest time in ms to fetch transfers for
3199
+ * @returns {object[]} a list of [transfer structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure}
3200
+ */
3201
+ await this.loadMarkets();
3202
+ if (limit === undefined) {
3203
+ limit = 10;
3204
+ }
3205
+ const request = {
3206
+ 'page': this.safeInteger(params, 'page', 1),
3207
+ 'limit': limit, // default is 10, max is 100
3208
+ };
3209
+ let currency = undefined;
3210
+ if (code !== undefined) {
3211
+ currency = this.currency(code);
3212
+ request['currency'] = currency['id'];
3213
+ }
3214
+ if (since !== undefined) {
3215
+ request['time_start'] = since;
3216
+ }
3217
+ if (limit !== undefined) {
3218
+ request['limit'] = limit;
3219
+ }
3220
+ const until = this.safeInteger2(params, 'until', 'till'); // unified in milliseconds
3221
+ const endTime = this.safeInteger(params, 'time_end', until); // exchange-specific in milliseconds
3222
+ params = this.omit(params, ['till', 'until']);
3223
+ if (endTime !== undefined) {
3224
+ request['time_end'] = endTime;
3225
+ }
3226
+ const response = await this.privatePostAccountV1TransferContractList(this.extend(request, params));
3072
3227
  //
3073
3228
  // {
3074
3229
  // "message": "OK",
3075
3230
  // "code": 1000,
3076
- // "trace": "b26cecec-ef5a-47d9-9531-2bd3911d3d55",
3231
+ // "trace": "7f9d93e10f9g4513bc08a7btc2a5559a.69.16953325693032193",
3077
3232
  // "data": {
3078
- // "transfer_id": "ca90d97a621e47d49774f19af6b029f5"
3233
+ // "records": [
3234
+ // {
3235
+ // "transfer_id": "902463535961567232",
3236
+ // "currency": "USDT",
3237
+ // "amount": "5",
3238
+ // "type": "contract_to_spot",
3239
+ // "state": "FINISHED",
3240
+ // "timestamp": 1695330539565
3241
+ // },
3242
+ // ]
3079
3243
  // }
3080
3244
  // }
3081
3245
  //
3082
- const data = this.safeValue(transfer, 'data', {});
3083
- return {
3084
- 'id': this.safeString(data, 'transfer_id'),
3085
- 'timestamp': undefined,
3086
- 'datetime': undefined,
3087
- 'currency': this.safeCurrencyCode(undefined, currency),
3088
- 'amount': undefined,
3089
- 'fromAccount': undefined,
3090
- 'toAccount': undefined,
3091
- 'status': this.parseTransferStatus(this.safeString2(transfer, 'code', 'message')),
3092
- };
3246
+ const data = this.safeValue(response, 'data', {});
3247
+ const records = this.safeValue(data, 'records', []);
3248
+ return this.parseTransfers(records, currency, since, limit);
3093
3249
  }
3094
3250
  async fetchBorrowInterest(code = undefined, symbol = undefined, since = undefined, limit = undefined, params = {}) {
3095
3251
  /**
package/js/src/bitrue.js CHANGED
@@ -1287,12 +1287,19 @@ export default class bitrue extends Exchange {
1287
1287
  * @method
1288
1288
  * @name bitrue#createOrder
1289
1289
  * @description create a trade order
1290
+ * @see https://github.com/Bitrue-exchange/Spot-official-api-docs#signed-endpoint-examples-for-post-apiv1order
1290
1291
  * @param {string} symbol unified symbol of the market to create an order in
1291
1292
  * @param {string} type 'market' or 'limit'
1292
1293
  * @param {string} side 'buy' or 'sell'
1293
1294
  * @param {float} amount how much of currency you want to trade in units of base currency
1294
1295
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1295
1296
  * @param {object} [params] extra parameters specific to the bitrue api endpoint
1297
+ * @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
1298
+ * @param {string} [params.clientOrderId] a unique id for the order, automatically generated if not sent
1299
+ *
1300
+ * EXCHANGE SPECIFIC PARAMETERS
1301
+ * @param {decimal} [params.icebergQty]
1302
+ * @param {long} [params.recvWindow]
1296
1303
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1297
1304
  */
1298
1305
  await this.loadMarkets();
package/js/src/bybit.js CHANGED
@@ -7,7 +7,7 @@
7
7
  // ---------------------------------------------------------------------------
8
8
  import Exchange from './abstract/bybit.js';
9
9
  import { TICK_SIZE } from './base/functions/number.js';
10
- import { AuthenticationError, ExchangeError, ArgumentsRequired, PermissionDenied, InvalidOrder, OrderNotFound, InsufficientFunds, BadRequest, RateLimitExceeded, InvalidNonce, NotSupported, RequestTimeout, BadSymbol } from './base/errors.js';
10
+ import { AuthenticationError, ExchangeError, ArgumentsRequired, PermissionDenied, InvalidOrder, OrderNotFound, InsufficientFunds, BadRequest, RateLimitExceeded, InvalidNonce, NotSupported, RequestTimeout, BadSymbol, MarginModeAlreadySet, NoChange } from './base/errors.js';
11
11
  import { Precise } from './base/Precise.js';
12
12
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
13
13
  import { rsa } from './base/functions/rsa.js';
@@ -727,12 +727,12 @@ export default class bybit extends Exchange {
727
727
  '110021': InvalidOrder,
728
728
  '110022': InvalidOrder,
729
729
  '110023': InvalidOrder,
730
- '110024': InvalidOrder,
731
- '110025': InvalidOrder,
732
- '110026': BadRequest,
733
- '110027': InvalidOrder,
734
- '110028': InvalidOrder,
735
- '110029': InvalidOrder,
730
+ '110024': BadRequest,
731
+ '110025': NoChange,
732
+ '110026': MarginModeAlreadySet,
733
+ '110027': NoChange,
734
+ '110028': BadRequest,
735
+ '110029': BadRequest,
736
736
  '110030': InvalidOrder,
737
737
  '110031': InvalidOrder,
738
738
  '110032': InvalidOrder,