ccxt 4.2.22 → 4.2.24

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.
@@ -3545,8 +3545,10 @@ class phemex extends phemex$1 {
3545
3545
  * @description fetch all open positions
3546
3546
  * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-trading-account-and-positions
3547
3547
  * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
3548
- * @param {string[]|undefined} symbols list of unified market symbols
3548
+ * @see https://phemex-docs.github.io/#query-account-positions-with-unrealized-pnl
3549
+ * @param {string[]} [symbols] list of unified market symbols
3549
3550
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3551
+ * @param {string} [param.method] *USDT contracts only* 'privateGetGAccountsAccountPositions' or 'privateGetAccountsPositions' default is 'privateGetGAccountsAccountPositions'
3550
3552
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
3551
3553
  */
3552
3554
  await this.loadMarkets();
@@ -3581,7 +3583,14 @@ class phemex extends phemex$1 {
3581
3583
  };
3582
3584
  let response = undefined;
3583
3585
  if (isUSDTSettled) {
3584
- response = await this.privateGetGAccountsAccountPositions(this.extend(request, params));
3586
+ let method = undefined;
3587
+ [method, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', 'privateGetGAccountsAccountPositions');
3588
+ if (method === 'privateGetGAccountsAccountPositions') {
3589
+ response = await this.privateGetGAccountsAccountPositions(this.extend(request, params));
3590
+ }
3591
+ else {
3592
+ response = await this.privateGetAccountsPositions(this.extend(request, params));
3593
+ }
3585
3594
  }
3586
3595
  else {
3587
3596
  response = await this.privateGetAccountsAccountPositions(this.extend(request, params));
@@ -3757,7 +3766,7 @@ class phemex extends phemex$1 {
3757
3766
  const contracts = this.safeString(position, 'size');
3758
3767
  const contractSize = this.safeValue(market, 'contractSize');
3759
3768
  const contractSizeString = this.numberToString(contractSize);
3760
- const leverage = this.safeNumber2(position, 'leverage', 'leverageRr');
3769
+ const leverage = this.parseNumber(Precise["default"].stringAbs((this.safeString2(position, 'leverage', 'leverageRr'))));
3761
3770
  const entryPriceString = this.safeString2(position, 'avgEntryPrice', 'avgEntryPriceRp');
3762
3771
  const rawSide = this.safeString(position, 'side');
3763
3772
  let side = undefined;
@@ -45,6 +45,7 @@ class poloniex extends poloniex$1 {
45
45
  'fetchDepositsWithdrawals': true,
46
46
  'fetchDepositWithdrawFee': 'emulated',
47
47
  'fetchDepositWithdrawFees': true,
48
+ 'fetchFundingRate': false,
48
49
  'fetchMarginMode': false,
49
50
  'fetchMarkets': true,
50
51
  'fetchMyTrades': true,
@@ -55,7 +56,6 @@ class poloniex extends poloniex$1 {
55
56
  'fetchOrder': true,
56
57
  'fetchOrderBook': true,
57
58
  'fetchOrderBooks': false,
58
- 'fetchFundingRate': false,
59
59
  'fetchOrderTrades': true,
60
60
  'fetchPosition': false,
61
61
  'fetchPositionMode': false,
@@ -986,7 +986,7 @@ class binance extends binance$1 {
986
986
  }
987
987
  else {
988
988
  // take the timestamp of the closing price for candlestick streams
989
- timestamp = this.safeInteger(message, 'C');
989
+ timestamp = this.safeInteger2(message, 'C', 'E');
990
990
  }
991
991
  const marketId = this.safeString(message, 's');
992
992
  const symbol = this.safeSymbol(marketId, undefined, undefined, marketType);
@@ -13,7 +13,7 @@ class bitopro extends bitopro$1 {
13
13
  'has': {
14
14
  'ws': true,
15
15
  'watchBalance': true,
16
- 'watchMyTrades': false,
16
+ 'watchMyTrades': true,
17
17
  'watchOHLCV': false,
18
18
  'watchOrderBook': true,
19
19
  'watchOrders': false,
@@ -174,6 +174,150 @@ class bitopro extends bitopro$1 {
174
174
  this.trades[symbol] = tradesCache;
175
175
  client.resolve(tradesCache, messageHash);
176
176
  }
177
+ async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
178
+ /**
179
+ * @method
180
+ * @name bitopro#watchMyTrades
181
+ * @description watches information on multiple trades made by the user
182
+ * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/private/matches_stream.md
183
+ * @param {string} symbol unified market symbol of the market trades were made in
184
+ * @param {int} [since] the earliest time in ms to fetch trades for
185
+ * @param {int} [limit] the maximum number of trade structures to retrieve
186
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
187
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure
188
+ */
189
+ this.checkRequiredCredentials();
190
+ await this.loadMarkets();
191
+ let messageHash = 'USER_TRADE';
192
+ if (symbol !== undefined) {
193
+ const market = this.market(symbol);
194
+ messageHash = messageHash + ':' + market['symbol'];
195
+ }
196
+ const url = this.urls['ws']['private'] + '/' + 'user-trades';
197
+ this.authenticate(url);
198
+ const trades = await this.watch(url, messageHash, undefined, messageHash);
199
+ if (this.newUpdates) {
200
+ limit = trades.getLimit(symbol, limit);
201
+ }
202
+ return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
203
+ }
204
+ handleMyTrade(client, message) {
205
+ //
206
+ // {
207
+ // "event": "USER_TRADE",
208
+ // "timestamp": 1694667358782,
209
+ // "datetime": "2023-09-14T12:55:58.782Z",
210
+ // "data": {
211
+ // "base": "usdt",
212
+ // "quote": "twd",
213
+ // "side": "ask",
214
+ // "price": "32.039",
215
+ // "volume": "1",
216
+ // "fee": "6407800",
217
+ // "feeCurrency": "twd",
218
+ // "transactionTimestamp": 1694667358,
219
+ // "eventTimestamp": 1694667358,
220
+ // "orderID": 390733918,
221
+ // "orderType": "LIMIT",
222
+ // "matchID": "bd07673a-94b1-419e-b5ee-d7b723261a5d",
223
+ // "isMarket": false,
224
+ // "isMaker": false
225
+ // }
226
+ // }
227
+ //
228
+ const data = this.safeValue(message, 'data', {});
229
+ const baseId = this.safeString(data, 'base');
230
+ const quoteId = this.safeString(data, 'quote');
231
+ const base = this.safeCurrencyCode(baseId);
232
+ const quote = this.safeCurrencyCode(quoteId);
233
+ const symbol = this.symbol(base + '/' + quote);
234
+ const messageHash = this.safeString(message, 'event');
235
+ if (this.myTrades === undefined) {
236
+ const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
237
+ this.myTrades = new Cache.ArrayCacheBySymbolById(limit);
238
+ }
239
+ const trades = this.myTrades;
240
+ const parsed = this.parseWsTrade(data);
241
+ trades.append(parsed);
242
+ client.resolve(trades, messageHash);
243
+ client.resolve(trades, messageHash + ':' + symbol);
244
+ }
245
+ parseWsTrade(trade, market = undefined) {
246
+ //
247
+ // {
248
+ // "base": "usdt",
249
+ // "quote": "twd",
250
+ // "side": "ask",
251
+ // "price": "32.039",
252
+ // "volume": "1",
253
+ // "fee": "6407800",
254
+ // "feeCurrency": "twd",
255
+ // "transactionTimestamp": 1694667358,
256
+ // "eventTimestamp": 1694667358,
257
+ // "orderID": 390733918,
258
+ // "orderType": "LIMIT",
259
+ // "matchID": "bd07673a-94b1-419e-b5ee-d7b723261a5d",
260
+ // "isMarket": false,
261
+ // "isMaker": false
262
+ // }
263
+ //
264
+ const id = this.safeString(trade, 'matchID');
265
+ const orderId = this.safeString(trade, 'orderID');
266
+ const timestamp = this.safeTimestamp(trade, 'transactionTimestamp');
267
+ const baseId = this.safeString(trade, 'base');
268
+ const quoteId = this.safeString(trade, 'quote');
269
+ const base = this.safeCurrencyCode(baseId);
270
+ const quote = this.safeCurrencyCode(quoteId);
271
+ const symbol = this.symbol(base + '/' + quote);
272
+ market = this.safeMarket(symbol, market);
273
+ const price = this.safeString(trade, 'price');
274
+ const type = this.safeStringLower(trade, 'orderType');
275
+ let side = this.safeString(trade, 'side');
276
+ if (side !== undefined) {
277
+ if (side === 'ask') {
278
+ side = 'sell';
279
+ }
280
+ else if (side === 'bid') {
281
+ side = 'buy';
282
+ }
283
+ }
284
+ const amount = this.safeString(trade, 'volume');
285
+ let fee = undefined;
286
+ const feeAmount = this.safeString(trade, 'fee');
287
+ const feeSymbol = this.safeCurrencyCode(this.safeString(trade, 'feeCurrency'));
288
+ if (feeAmount !== undefined) {
289
+ fee = {
290
+ 'cost': feeAmount,
291
+ 'currency': feeSymbol,
292
+ 'rate': undefined,
293
+ };
294
+ }
295
+ const isMaker = this.safeValue(trade, 'isMaker');
296
+ let takerOrMaker = undefined;
297
+ if (isMaker !== undefined) {
298
+ if (isMaker) {
299
+ takerOrMaker = 'maker';
300
+ }
301
+ else {
302
+ takerOrMaker = 'taker';
303
+ }
304
+ }
305
+ return this.safeTrade({
306
+ 'id': id,
307
+ 'info': trade,
308
+ 'order': orderId,
309
+ 'timestamp': timestamp,
310
+ 'datetime': this.iso8601(timestamp),
311
+ 'symbol': symbol,
312
+ 'takerOrMaker': takerOrMaker,
313
+ 'type': type,
314
+ 'side': side,
315
+ 'price': price,
316
+ 'amount': amount,
317
+ 'cost': undefined,
318
+ 'fee': fee,
319
+ }, market);
320
+ }
177
321
  async watchTicker(symbol, params = {}) {
178
322
  /**
179
323
  * @method
@@ -316,6 +460,7 @@ class bitopro extends bitopro$1 {
316
460
  'TICKER': this.handleTicker,
317
461
  'ORDER_BOOK': this.handleOrderBook,
318
462
  'ACCOUNT_BALANCE': this.handleBalance,
463
+ 'USER_TRADE': this.handleMyTrade,
319
464
  };
320
465
  const event = this.safeString(message, 'event');
321
466
  const method = this.safeValue(methods, event);
@@ -32,6 +32,12 @@ class hitbtc extends hitbtc$1 {
32
32
  'private': 'wss://api.hitbtc.com/api/3/ws/trading',
33
33
  },
34
34
  },
35
+ 'test': {
36
+ 'ws': {
37
+ 'public': 'wss://api.demo.hitbtc.com/api/3/ws/public',
38
+ 'private': 'wss://api.demo.hitbtc.com/api/3/ws/trading',
39
+ },
40
+ },
35
41
  },
36
42
  'options': {
37
43
  'tradesLimit': 1000,
@@ -850,13 +850,15 @@ class okx extends okx$1 {
850
850
  /**
851
851
  * @method
852
852
  * @name okx#watchMyTrades
853
- * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
854
853
  * @description watches information on multiple trades made by the user
854
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
855
855
  * @param {string} [symbol] unified market symbol of the market trades were made in
856
856
  * @param {int} [since] the earliest time in ms to fetch trades for
857
857
  * @param {int} [limit] the maximum number of trade structures to retrieve
858
858
  * @param {object} [params] extra parameters specific to the exchange API endpoint
859
859
  * @param {bool} [params.stop] true if fetching trigger or conditional trades
860
+ * @param {string} [params.type] 'spot', 'swap', 'future', 'option', 'ANY', 'SPOT', 'MARGIN', 'SWAP', 'FUTURES' or 'OPTION'
861
+ * @param {string} [params.marginMode] 'cross' or 'isolated', for automatically setting the type to spot margin
860
862
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure
861
863
  */
862
864
  // By default, receive order updates from any instrument type
@@ -878,7 +880,14 @@ class okx extends okx$1 {
878
880
  if (type === 'future') {
879
881
  type = 'futures';
880
882
  }
881
- const uppercaseType = type.toUpperCase();
883
+ let uppercaseType = type.toUpperCase();
884
+ let marginMode = undefined;
885
+ [marginMode, params] = this.handleMarginModeAndParams('watchMyTrades', params);
886
+ if (uppercaseType === 'SPOT') {
887
+ if (marginMode !== undefined) {
888
+ uppercaseType = 'MARGIN';
889
+ }
890
+ }
882
891
  const request = {
883
892
  'instType': uppercaseType,
884
893
  };
@@ -1024,7 +1033,6 @@ class okx extends okx$1 {
1024
1033
  */
1025
1034
  let type = undefined;
1026
1035
  // By default, receive order updates from any instrument type
1027
- [type, params] = this.handleOptionAndParams(params, 'watchOrders', 'defaultType');
1028
1036
  [type, params] = this.handleOptionAndParams(params, 'watchOrders', 'type', 'ANY');
1029
1037
  const isStop = this.safeValue2(params, 'stop', 'trigger', false);
1030
1038
  params = this.omit(params, ['stop', 'trigger']);
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } from './src/base/types.js';
6
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.2.21";
7
+ declare const version = "4.2.23";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
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.2.22';
41
+ const version = '4.2.24';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -243,6 +243,37 @@ interface binance {
243
243
  sapiGetSimpleEarnFlexibleHistoryRewardsRecord(params?: {}): Promise<implicitReturnType>;
244
244
  sapiGetSimpleEarnLockedHistoryRewardsRecord(params?: {}): Promise<implicitReturnType>;
245
245
  sapiGetSimpleEarnFlexibleHistoryCollateralRecord(params?: {}): Promise<implicitReturnType>;
246
+ sapiGetAssetAssetDistributionHistory(params?: {}): Promise<implicitReturnType>;
247
+ sapiGetAssetQueryTradingFee(params?: {}): Promise<implicitReturnType>;
248
+ sapiGetAssetQueryTradingVolume(params?: {}): Promise<implicitReturnType>;
249
+ sapiGetOtcCoinPairs(params?: {}): Promise<implicitReturnType>;
250
+ sapiGetOtcOrdersOrderId(params?: {}): Promise<implicitReturnType>;
251
+ sapiGetOtcOrders(params?: {}): Promise<implicitReturnType>;
252
+ sapiGetOcbsOrders(params?: {}): Promise<implicitReturnType>;
253
+ sapiGetFiatpaymentQueryWithdrawHistory(params?: {}): Promise<implicitReturnType>;
254
+ sapiGetFiatpaymentQueryDepositHistory(params?: {}): Promise<implicitReturnType>;
255
+ sapiGetCapitalSubAccountDepositAddress(params?: {}): Promise<implicitReturnType>;
256
+ sapiGetCapitalSubAccountDepositHistory(params?: {}): Promise<implicitReturnType>;
257
+ sapiGetAssetQueryDustLogs(params?: {}): Promise<implicitReturnType>;
258
+ sapiGetAssetQueryDustAssets(params?: {}): Promise<implicitReturnType>;
259
+ sapiGetMarketingReferralRewardHistory(params?: {}): Promise<implicitReturnType>;
260
+ sapiGetStakingAsset(params?: {}): Promise<implicitReturnType>;
261
+ sapiGetStakingStakingBalance(params?: {}): Promise<implicitReturnType>;
262
+ sapiGetStakingHistory(params?: {}): Promise<implicitReturnType>;
263
+ sapiGetStakingStakingRewardsHistory(params?: {}): Promise<implicitReturnType>;
264
+ sapiGetCustodianBalance(params?: {}): Promise<implicitReturnType>;
265
+ sapiGetCustodianSupportedAssetList(params?: {}): Promise<implicitReturnType>;
266
+ sapiGetCustodianWalletTransferHistory(params?: {}): Promise<implicitReturnType>;
267
+ sapiGetCustodianCustodianTransferHistory(params?: {}): Promise<implicitReturnType>;
268
+ sapiGetCustodianOpenOrders(params?: {}): Promise<implicitReturnType>;
269
+ sapiGetCustodianOrder(params?: {}): Promise<implicitReturnType>;
270
+ sapiGetCustodianOrderHistory(params?: {}): Promise<implicitReturnType>;
271
+ sapiGetCustodianTradeHistory(params?: {}): Promise<implicitReturnType>;
272
+ sapiGetCustodianSettlementSetting(params?: {}): Promise<implicitReturnType>;
273
+ sapiGetCustodianSettlementHistory(params?: {}): Promise<implicitReturnType>;
274
+ sapiGetClTransferHistory(params?: {}): Promise<implicitReturnType>;
275
+ sapiGetApipartnerCheckEligibility(params?: {}): Promise<implicitReturnType>;
276
+ sapiGetApipartnerRebateHistory(params?: {}): Promise<implicitReturnType>;
246
277
  sapiPostAssetDust(params?: {}): Promise<implicitReturnType>;
247
278
  sapiPostAssetDustBtc(params?: {}): Promise<implicitReturnType>;
248
279
  sapiPostAssetTransfer(params?: {}): Promise<implicitReturnType>;
@@ -357,6 +388,17 @@ interface binance {
357
388
  sapiPostSimpleEarnLockedRedeem(params?: {}): Promise<implicitReturnType>;
358
389
  sapiPostSimpleEarnFlexibleSetAutoSubscribe(params?: {}): Promise<implicitReturnType>;
359
390
  sapiPostSimpleEarnLockedSetAutoSubscribe(params?: {}): Promise<implicitReturnType>;
391
+ sapiPostOtcQuotes(params?: {}): Promise<implicitReturnType>;
392
+ sapiPostOtcOrders(params?: {}): Promise<implicitReturnType>;
393
+ sapiPostFiatpaymentWithdrawApply(params?: {}): Promise<implicitReturnType>;
394
+ sapiPostStakingStake(params?: {}): Promise<implicitReturnType>;
395
+ sapiPostStakingUnstake(params?: {}): Promise<implicitReturnType>;
396
+ sapiPostCustodianWalletTransfer(params?: {}): Promise<implicitReturnType>;
397
+ sapiPostCustodianCustodianTransfer(params?: {}): Promise<implicitReturnType>;
398
+ sapiPostCustodianUndoTransfer(params?: {}): Promise<implicitReturnType>;
399
+ sapiPostCustodianOrder(params?: {}): Promise<implicitReturnType>;
400
+ sapiPostCustodianOcoOrder(params?: {}): Promise<implicitReturnType>;
401
+ sapiPostClTransfer(params?: {}): Promise<implicitReturnType>;
360
402
  sapiPutUserDataStream(params?: {}): Promise<implicitReturnType>;
361
403
  sapiPutUserDataStreamIsolated(params?: {}): Promise<implicitReturnType>;
362
404
  sapiDeleteMarginOpenOrders(params?: {}): Promise<implicitReturnType>;
@@ -370,14 +412,24 @@ interface binance {
370
412
  sapiDeleteAlgoSpotOrder(params?: {}): Promise<implicitReturnType>;
371
413
  sapiDeleteAlgoFuturesOrder(params?: {}): Promise<implicitReturnType>;
372
414
  sapiDeleteSubAccountSubAccountApiIpRestrictionIpList(params?: {}): Promise<implicitReturnType>;
415
+ sapiDeleteCustodianCancelOrder(params?: {}): Promise<implicitReturnType>;
416
+ sapiDeleteCustodianCancelOrdersBySymbol(params?: {}): Promise<implicitReturnType>;
417
+ sapiDeleteCustodianCancelOcoOrder(params?: {}): Promise<implicitReturnType>;
373
418
  sapiV2GetEthStakingAccount(params?: {}): Promise<implicitReturnType>;
374
419
  sapiV2GetSubAccountFuturesAccount(params?: {}): Promise<implicitReturnType>;
375
420
  sapiV2GetSubAccountFuturesAccountSummary(params?: {}): Promise<implicitReturnType>;
376
421
  sapiV2GetSubAccountFuturesPositionRisk(params?: {}): Promise<implicitReturnType>;
422
+ sapiV2GetClAccount(params?: {}): Promise<implicitReturnType>;
423
+ sapiV2GetClAlertHistory(params?: {}): Promise<implicitReturnType>;
377
424
  sapiV2PostEthStakingEthStake(params?: {}): Promise<implicitReturnType>;
378
425
  sapiV2PostSubAccountSubAccountApiIpRestriction(params?: {}): Promise<implicitReturnType>;
379
426
  sapiV3GetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
427
+ sapiV3GetAccountStatus(params?: {}): Promise<implicitReturnType>;
428
+ sapiV3GetApiTradingStatus(params?: {}): Promise<implicitReturnType>;
429
+ sapiV3GetSubAccountList(params?: {}): Promise<implicitReturnType>;
430
+ sapiV3GetSubAccountTransferHistory(params?: {}): Promise<implicitReturnType>;
380
431
  sapiV3PostAssetGetUserAsset(params?: {}): Promise<implicitReturnType>;
432
+ sapiV3PostSubAccountTransfer(params?: {}): Promise<implicitReturnType>;
381
433
  sapiV4GetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
382
434
  dapiPublicGetPing(params?: {}): Promise<implicitReturnType>;
383
435
  dapiPublicGetTime(params?: {}): Promise<implicitReturnType>;
@@ -594,7 +646,6 @@ interface binance {
594
646
  privateGetMyPreventedMatches(params?: {}): Promise<implicitReturnType>;
595
647
  privateGetMyAllocations(params?: {}): Promise<implicitReturnType>;
596
648
  privateGetAccountCommission(params?: {}): Promise<implicitReturnType>;
597
- privateGetStatus(params?: {}): Promise<implicitReturnType>;
598
649
  privatePostOrderOco(params?: {}): Promise<implicitReturnType>;
599
650
  privatePostSorOrder(params?: {}): Promise<implicitReturnType>;
600
651
  privatePostSorOrderTest(params?: {}): Promise<implicitReturnType>;
@@ -13,6 +13,7 @@ export default class binanceus extends binance {
13
13
  'id': 'binanceus',
14
14
  'name': 'Binance US',
15
15
  'countries': ['US'],
16
+ 'hostname': 'binance.us',
16
17
  'rateLimit': 50,
17
18
  'certified': false,
18
19
  'pro': true,
@@ -20,10 +21,11 @@ export default class binanceus extends binance {
20
21
  'logo': 'https://user-images.githubusercontent.com/1294454/65177307-217b7c80-da5f-11e9-876e-0b748ba0a358.jpg',
21
22
  'api': {
22
23
  'web': 'https://www.binance.us',
23
- 'sapi': 'https://api.binance.us/sapi/v1',
24
- 'wapi': 'https://api.binance.us/wapi/v3',
25
24
  'public': 'https://api.binance.us/api/v3',
26
25
  'private': 'https://api.binance.us/api/v3',
26
+ 'sapi': 'https://api.binance.us/sapi/v1',
27
+ 'sapiV2': 'https://api.binance.us/sapi/v2',
28
+ 'sapiV3': 'https://api.binance.us/sapi/v3',
27
29
  },
28
30
  'www': 'https://www.binance.us',
29
31
  'referral': 'https://www.binance.us/?ref=35005074',
@@ -84,13 +86,13 @@ export default class binanceus extends binance {
84
86
  'api': {
85
87
  'public': {
86
88
  'get': {
87
- 'exchangeInfo': 10,
88
89
  'ping': 1,
89
90
  'time': 1,
90
- 'depth': { 'cost': 1, 'byLimit': [[100, 1], [500, 5], [1000, 10], [5000, 50]] },
91
+ 'exchangeInfo': 10,
91
92
  'trades': 1,
92
- 'aggTrades': 1,
93
93
  'historicalTrades': 5,
94
+ 'aggTrades': 1,
95
+ 'depth': { 'cost': 1, 'byLimit': [[100, 1], [500, 5], [1000, 10], [5000, 50]] },
94
96
  'klines': 1,
95
97
  'ticker/price': { 'cost': 1, 'noSymbol': 2 },
96
98
  'avgPrice': 1,
@@ -101,7 +103,107 @@ export default class binanceus extends binance {
101
103
  },
102
104
  'private': {
103
105
  'get': {
104
- 'status': 1,
106
+ 'account': 10,
107
+ 'rateLimit/order': 20,
108
+ 'order': 2,
109
+ 'openOrders': { 'cost': 3, 'noSymbol': 40 },
110
+ 'myTrades': 10,
111
+ 'myPreventedMatches': 10,
112
+ 'allOrders': 10,
113
+ 'orderList': 2,
114
+ 'allOrderList': 10,
115
+ 'openOrderList': 3,
116
+ },
117
+ 'post': {
118
+ 'order': 1,
119
+ 'order/test': 1,
120
+ 'order/cancelReplace': 1,
121
+ 'order/oco': 1,
122
+ },
123
+ 'delete': {
124
+ 'order': 1,
125
+ 'openOrders': 1,
126
+ 'orderList': 1,
127
+ },
128
+ },
129
+ 'sapi': {
130
+ 'get': {
131
+ 'system/status': 1,
132
+ 'asset/assetDistributionHistory': 1,
133
+ 'asset/query/trading-fee': 1,
134
+ 'asset/query/trading-volume': 1,
135
+ 'sub-account/spotSummary': 1,
136
+ 'sub-account/status': 1,
137
+ 'otc/coinPairs': 1,
138
+ 'otc/orders/{orderId}': 1,
139
+ 'otc/orders': 1,
140
+ 'ocbs/orders': 1,
141
+ 'capital/config/getall': 1,
142
+ 'capital/withdraw/history': 1,
143
+ 'fiatpayment/query/withdraw/history': 1,
144
+ 'capital/deposit/address': 1,
145
+ 'capital/deposit/hisrec': 1,
146
+ 'fiatpayment/query/deposit/history': 1,
147
+ 'capital/sub-account/deposit/address': 1,
148
+ 'capital/sub-account/deposit/history': 1,
149
+ 'asset/query/dust-logs': 1,
150
+ 'asset/query/dust-assets': 1,
151
+ 'marketing/referral/reward/history': 1,
152
+ 'staking/asset': 1,
153
+ 'staking/stakingBalance': 1,
154
+ 'staking/history': 1,
155
+ 'staking/stakingRewardsHistory': 1,
156
+ 'custodian/balance': 1,
157
+ 'custodian/supportedAssetList': 1,
158
+ 'custodian/walletTransferHistory': 1,
159
+ 'custodian/custodianTransferHistory': 1,
160
+ 'custodian/openOrders': 1,
161
+ 'custodian/order': 1,
162
+ 'custodian/orderHistory': 1,
163
+ 'custodian/tradeHistory': 1,
164
+ 'custodian/settlementSetting': 1,
165
+ 'custodian/settlementHistory': 1,
166
+ 'cl/transferHistory': 1,
167
+ 'apipartner/checkEligibility': 1,
168
+ 'apipartner/rebateHistory': 1,
169
+ },
170
+ 'post': {
171
+ 'otc/quotes': 1,
172
+ 'otc/orders': 1,
173
+ 'fiatpayment/withdraw/apply': 1,
174
+ 'capital/withdraw/apply': 1,
175
+ 'asset/dust': 10,
176
+ 'staking/stake': 1,
177
+ 'staking/unstake': 1,
178
+ 'custodian/walletTransfer': 1,
179
+ 'custodian/custodianTransfer': 1,
180
+ 'custodian/undoTransfer': 1,
181
+ 'custodian/order': 1,
182
+ 'custodian/ocoOrder': 1,
183
+ 'cl/transfer': 1,
184
+ },
185
+ 'delete': {
186
+ 'custodian/cancelOrder': 1,
187
+ 'custodian/cancelOrdersBySymbol': 1,
188
+ 'custodian/cancelOcoOrder': 1,
189
+ },
190
+ },
191
+ 'sapiV2': {
192
+ 'get': {
193
+ 'cl/account': 10,
194
+ 'cl/alertHistory': 1,
195
+ },
196
+ },
197
+ 'sapiV3': {
198
+ 'get': {
199
+ 'accountStatus': 1,
200
+ 'apiTradingStatus': 1,
201
+ 'sub-account/list': 1,
202
+ 'sub-account/transfer/history': 1,
203
+ 'sub-account/assets': 1,
204
+ },
205
+ 'post': {
206
+ 'sub-account/transfer': 1,
105
207
  },
106
208
  },
107
209
  },
package/js/src/bingx.js CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
8
  import Exchange from './abstract/bingx.js';
9
- import { AuthenticationError, ExchangeNotAvailable, PermissionDenied, AccountSuspended, ExchangeError, InsufficientFunds, BadRequest, OrderNotFound, DDoSProtection, BadSymbol, ArgumentsRequired, NotSupported } from './base/errors.js';
9
+ import { AuthenticationError, PermissionDenied, AccountSuspended, ExchangeError, InsufficientFunds, BadRequest, OrderNotFound, DDoSProtection, BadSymbol, ArgumentsRequired, NotSupported } from './base/errors.js';
10
10
  import { Precise } from './base/Precise.js';
11
11
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
12
12
  import { DECIMAL_PLACES } from './base/functions/number.js';
@@ -363,7 +363,7 @@ export default class bingx extends Exchange {
363
363
  '100500': ExchangeError,
364
364
  '100503': ExchangeError,
365
365
  '80001': BadRequest,
366
- '80012': ExchangeNotAvailable,
366
+ '80012': InsufficientFunds,
367
367
  '80014': BadRequest,
368
368
  '80016': OrderNotFound,
369
369
  '80017': OrderNotFound,
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bitfinex2.js';
2
- import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderBook, Str, Transaction, Ticker, Balances, Tickers, Strings, Currency, Market } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderBook, Str, Transaction, Ticker, Balances, Tickers, Strings, Currency, Market, OpenInterest } from './base/types.js';
3
3
  /**
4
4
  * @class bitfinex2
5
5
  * @augments Exchange
@@ -156,4 +156,7 @@ export default class bitfinex2 extends Exchange {
156
156
  previousFundingTimestamp: any;
157
157
  previousFundingDatetime: any;
158
158
  };
159
+ fetchOpenInterest(symbol: string, params?: {}): Promise<OpenInterest>;
160
+ fetchOpenInterestHistory(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OpenInterest[]>;
161
+ parseOpenInterest(interest: any, market?: Market): OpenInterest;
159
162
  }