ccxt 4.2.54 → 4.2.56

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.
@@ -636,7 +636,7 @@ export default class Exchange {
636
636
  filterByLimit(array: object[], limit?: Int, key?: IndexType, fromStart?: boolean): any;
637
637
  filterBySinceLimit(array: object[], since?: Int, limit?: Int, key?: IndexType, tail?: boolean): any;
638
638
  filterByValueSinceLimit(array: object[], field: IndexType, value?: any, since?: Int, limit?: Int, key?: string, tail?: boolean): any;
639
- setSandboxMode(enabled: any): void;
639
+ setSandboxMode(enabled: boolean): void;
640
640
  sign(path: any, api?: any, method?: string, params?: {}, headers?: any, body?: any): {};
641
641
  fetchAccounts(params?: {}): Promise<{}>;
642
642
  fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
@@ -11,8 +11,8 @@ export declare type SubType = 'linear' | 'inverse' | undefined;
11
11
  export interface Dictionary<T> {
12
12
  [key: string]: T;
13
13
  }
14
- export declare type Dict = Dictionary<any>;
15
- export declare type List = Array<any>;
14
+ export declare type Dict = Dictionary<any> | undefined;
15
+ export declare type List = Array<any> | undefined;
16
16
  /** Request parameters */
17
17
  export interface MinMax {
18
18
  min: Num;
package/js/src/bingx.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bingx.js';
2
- import type { TransferEntry, Int, OrderSide, OHLCV, FundingRateHistory, Order, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, OHLCV, FundingRateHistory, Order, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position, Dict } from './base/types.js';
3
3
  /**
4
4
  * @class bingx
5
5
  * @augments Exchange
@@ -61,7 +61,7 @@ export default class bingx extends Exchange {
61
61
  parseOpenInterest(interest: any, market?: Market): import("./base/types.js").OpenInterest;
62
62
  fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
63
63
  fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
64
- parseTicker(ticker: any, market?: Market): Ticker;
64
+ parseTicker(ticker: Dict, market?: Market): Ticker;
65
65
  fetchBalance(params?: {}): Promise<Balances>;
66
66
  parseBalance(response: any): Balances;
67
67
  fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
@@ -107,7 +107,7 @@ export default class bingx extends Exchange {
107
107
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
108
108
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
109
109
  parseTransaction(transaction: any, currency?: Currency): Transaction;
110
- parseTransactionStatus(status: any): string;
110
+ parseTransactionStatus(status: string): string;
111
111
  setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
112
112
  setMargin(symbol: string, amount: number, params?: {}): Promise<any>;
113
113
  fetchLeverage(symbol: string, params?: {}): Promise<any>;
@@ -145,6 +145,6 @@ export default class bingx extends Exchange {
145
145
  headers: any;
146
146
  };
147
147
  nonce(): number;
148
- setSandboxMode(enable: any): void;
148
+ setSandboxMode(enable: boolean): void;
149
149
  handleErrors(httpCode: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
150
150
  }
package/js/src/bingx.js CHANGED
@@ -1402,7 +1402,9 @@ export default class bingx extends Exchange {
1402
1402
  if (symbols !== undefined) {
1403
1403
  symbols = this.marketSymbols(symbols);
1404
1404
  const firstSymbol = this.safeString(symbols, 0);
1405
- market = this.market(firstSymbol);
1405
+ if (firstSymbol !== undefined) {
1406
+ market = this.market(firstSymbol);
1407
+ }
1406
1408
  }
1407
1409
  let type = undefined;
1408
1410
  [type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
package/js/src/bybit.js CHANGED
@@ -81,6 +81,7 @@ export default class bybit extends Exchange {
81
81
  'fetchIsolatedBorrowRate': false,
82
82
  'fetchIsolatedBorrowRates': false,
83
83
  'fetchLedger': true,
84
+ 'fetchLeverage': true,
84
85
  'fetchMarketLeverageTiers': true,
85
86
  'fetchMarkets': true,
86
87
  'fetchMarkOHLCV': true,
@@ -111,7 +112,6 @@ export default class bybit extends Exchange {
111
112
  'fetchUnderlyingAssets': false,
112
113
  'fetchVolatilityHistory': true,
113
114
  'fetchWithdrawals': true,
114
- 'fetchLeverage': true,
115
115
  'repayCrossMargin': true,
116
116
  'setLeverage': true,
117
117
  'setMarginMode': true,
package/js/src/gate.js CHANGED
@@ -48,7 +48,7 @@ export default class gate extends Exchange {
48
48
  'spot': 'https://api.gateio.ws/api/v4',
49
49
  'options': 'https://api.gateio.ws/api/v4',
50
50
  'subAccounts': 'https://api.gateio.ws/api/v4',
51
- 'portfolio': 'https://api.gateio.ws/api/v4',
51
+ 'unified': 'https://api.gateio.ws/api/v4',
52
52
  'rebate': 'https://api.gateio.ws/api/v4',
53
53
  'earn': 'https://api.gateio.ws/api/v4',
54
54
  'account': 'https://api.gateio.ws/api/v4',
@@ -271,11 +271,14 @@ export default class gate extends Exchange {
271
271
  'saved_address': 1,
272
272
  'fee': 1,
273
273
  'total_balance': 2.5,
274
+ 'small_balance': 1,
275
+ 'small_balance_history': 1,
274
276
  },
275
277
  'post': {
276
278
  'transfers': 2.5,
277
279
  'sub_account_transfers': 2.5,
278
280
  'sub_account_to_sub_account': 2.5,
281
+ 'small_balance': 1,
279
282
  },
280
283
  },
281
284
  'subAccounts': {
@@ -298,7 +301,7 @@ export default class gate extends Exchange {
298
301
  'sub_accounts/{user_id}/keys/{key}': 2.5,
299
302
  },
300
303
  },
301
- 'portfolio': {
304
+ 'unified': {
302
305
  'get': {
303
306
  'accounts': 20 / 15,
304
307
  'account_mode': 20 / 15,
@@ -307,6 +310,7 @@ export default class gate extends Exchange {
307
310
  'loans': 20 / 15,
308
311
  'loan_records': 20 / 15,
309
312
  'interest_records': 20 / 15,
313
+ 'estimate_rate': 20 / 15,
310
314
  },
311
315
  'post': {
312
316
  'account_mode': 20 / 15,
package/js/src/okx.js CHANGED
@@ -576,6 +576,7 @@ export default class okx extends Exchange {
576
576
  '50027': PermissionDenied,
577
577
  '50028': ExchangeError,
578
578
  '50044': BadRequest,
579
+ '50062': ExchangeError,
579
580
  // API Class
580
581
  '50100': ExchangeError,
581
582
  '50101': AuthenticationError,
@@ -630,6 +631,15 @@ export default class okx extends Exchange {
630
631
  '51072': InvalidOrder,
631
632
  '51073': InvalidOrder,
632
633
  '51074': InvalidOrder,
634
+ '51090': InvalidOrder,
635
+ '51091': InvalidOrder,
636
+ '51092': InvalidOrder,
637
+ '51093': InvalidOrder,
638
+ '51094': InvalidOrder,
639
+ '51095': InvalidOrder,
640
+ '51096': InvalidOrder,
641
+ '51098': InvalidOrder,
642
+ '51099': InvalidOrder,
633
643
  '51100': InvalidOrder,
634
644
  '51101': InvalidOrder,
635
645
  '51102': InvalidOrder,
@@ -2757,7 +2767,7 @@ export default class okx extends Exchange {
2757
2767
  }
2758
2768
  request['tpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
2759
2769
  const takeProfitLimitPrice = this.safeValueN(takeProfit, ['price', 'takeProfitPrice', 'tpOrdPx']);
2760
- const takeProfitOrderType = this.safeString(takeProfit, 'type');
2770
+ const takeProfitOrderType = this.safeString2(takeProfit, 'type', 'tpOrdKind');
2761
2771
  if (takeProfitOrderType !== undefined) {
2762
2772
  const takeProfitLimitOrderType = (takeProfitOrderType === 'limit');
2763
2773
  const takeProfitMarketOrderType = (takeProfitOrderType === 'market');
@@ -2769,6 +2779,7 @@ export default class okx extends Exchange {
2769
2779
  throw new InvalidOrder(this.id + ' createOrder() requires a limit price in params["takeProfit"]["price"] or params["takeProfit"]["tpOrdPx"] for a take profit limit order');
2770
2780
  }
2771
2781
  else {
2782
+ request['tpOrdKind'] = takeProfitOrderType;
2772
2783
  request['tpOrdPx'] = this.priceToPrecision(symbol, takeProfitLimitPrice);
2773
2784
  }
2774
2785
  }
@@ -2777,6 +2788,7 @@ export default class okx extends Exchange {
2777
2788
  }
2778
2789
  }
2779
2790
  else if (takeProfitLimitPrice !== undefined) {
2791
+ request['tpOrdKind'] = 'limit';
2780
2792
  request['tpOrdPx'] = this.priceToPrecision(symbol, takeProfitLimitPrice); // limit tp order
2781
2793
  }
2782
2794
  else {
@@ -2801,6 +2813,7 @@ export default class okx extends Exchange {
2801
2813
  const twoWayCondition = ((takeProfitPrice !== undefined) && (stopLossPrice !== undefined));
2802
2814
  // if TP and SL are sent together
2803
2815
  // as ordType 'conditional' only stop-loss order will be applied
2816
+ // tpOrdKind is 'condition' which is the default
2804
2817
  if (twoWayCondition) {
2805
2818
  request['ordType'] = 'oco';
2806
2819
  }
@@ -2854,6 +2867,7 @@ export default class okx extends Exchange {
2854
2867
  * @param {string} [params.stopLoss.type] 'market' or 'limit' used to specify the stop loss price type
2855
2868
  * @param {string} [params.positionSide] if position mode is one-way: set to 'net', if position mode is hedge-mode: set to 'long' or 'short'
2856
2869
  * @param {string} [params.trailingPercent] the percent to trail away from the current market price
2870
+ * @param {string} [params.tpOrdKind] 'condition' or 'limit', the default is 'condition'
2857
2871
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2858
2872
  */
2859
2873
  await this.loadMarkets();
@@ -3019,6 +3033,7 @@ export default class okx extends Exchange {
3019
3033
  takeProfitTriggerPrice = this.safeValue(takeProfit, 'triggerPrice');
3020
3034
  takeProfitPrice = this.safeValue(takeProfit, 'price');
3021
3035
  const takeProfitType = this.safeString(takeProfit, 'type');
3036
+ request['newTpOrdKind'] = (takeProfitType === 'limit') ? takeProfitType : 'condition';
3022
3037
  request['newTpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
3023
3038
  request['newTpOrdPx'] = (takeProfitType === 'market') ? '-1' : this.priceToPrecision(symbol, takeProfitPrice);
3024
3039
  request['newTpTriggerPxType'] = takeProfitTriggerPriceType;
@@ -3064,6 +3079,7 @@ export default class okx extends Exchange {
3064
3079
  * @param {float} [params.takeProfit.triggerPrice] take profit trigger price
3065
3080
  * @param {float} [params.takeProfit.price] used for take profit limit orders, not used for take profit market price orders
3066
3081
  * @param {string} [params.takeProfit.type] 'market' or 'limit' used to specify the take profit price type
3082
+ * @param {string} [params.newTpOrdKind] 'condition' or 'limit', the default is 'condition'
3067
3083
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3068
3084
  */
3069
3085
  await this.loadMarkets();
@@ -34,7 +34,6 @@ export default class bitget extends bitgetRest {
34
34
  parseWsOrderStatus(status: any): string;
35
35
  watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
36
36
  handleMyTrades(client: Client, message: any): void;
37
- parseWsMyTrade(trade: any, market?: any): Trade;
38
37
  watchBalance(params?: {}): Promise<Balances>;
39
38
  handleBalance(client: Client, message: any): void;
40
39
  watchPublic(messageHash: any, args: any, params?: {}): Promise<any>;
@@ -92,7 +92,10 @@ export default class bitget extends bitgetRest {
92
92
  }
93
93
  getInstType(market, params = {}) {
94
94
  let instType = undefined;
95
- if ((market['swap']) || (market['future'])) {
95
+ if (market === undefined) {
96
+ [instType, params] = this.handleProductTypeAndParams(undefined, params);
97
+ }
98
+ else if ((market['swap']) || (market['future'])) {
96
99
  [instType, params] = this.handleProductTypeAndParams(market, params);
97
100
  }
98
101
  else {
@@ -669,9 +672,12 @@ export default class bitget extends bitgetRest {
669
672
  stored = new ArrayCache(limit);
670
673
  this.trades[symbol] = stored;
671
674
  }
672
- const data = this.safeValue(message, 'data', []);
673
- for (let j = 0; j < data.length; j++) {
674
- const rawTrade = data[j];
675
+ const data = this.safeList(message, 'data', []);
676
+ const length = data.length;
677
+ const maxLength = Math.max(length - 1, 0);
678
+ // fix chronological order by reversing
679
+ for (let i = maxLength; i >= 0; i--) {
680
+ const rawTrade = data[i];
675
681
  const parsed = this.parseWsTrade(rawTrade, market);
676
682
  stored.append(parsed);
677
683
  }
@@ -688,22 +694,71 @@ export default class bitget extends bitgetRest {
688
694
  // "tradeId": "1116461060594286593"
689
695
  // }
690
696
  //
691
- market = this.safeMarket(undefined, market);
692
- const timestamp = this.safeInteger(trade, 'ts');
697
+ // order with trade in it
698
+ // {
699
+ // accBaseVolume: '0.1',
700
+ // baseVolume: '0.1',
701
+ // cTime: '1709221342922',
702
+ // clientOid: '1147122943507734528',
703
+ // enterPointSource: 'API',
704
+ // feeDetail: [Array],
705
+ // fillFee: '-0.0049578',
706
+ // fillFeeCoin: 'USDT',
707
+ // fillNotionalUsd: '8.263',
708
+ // fillPrice: '82.63',
709
+ // fillTime: '1709221342986',
710
+ // force: 'gtc',
711
+ // instId: 'LTCUSDT',
712
+ // leverage: '10',
713
+ // marginCoin: 'USDT',
714
+ // marginMode: 'crossed',
715
+ // notionalUsd: '8.268',
716
+ // orderId: '1147122943499345921',
717
+ // orderType: 'market',
718
+ // pnl: '0',
719
+ // posMode: 'hedge_mode',
720
+ // posSide: 'short',
721
+ // price: '0',
722
+ // priceAvg: '82.63',
723
+ // reduceOnly: 'no',
724
+ // side: 'sell',
725
+ // size: '0.1',
726
+ // status: 'filled',
727
+ // tradeId: '1147122943772479563',
728
+ // tradeScope: 'T',
729
+ // tradeSide: 'open',
730
+ // uTime: '1709221342986'
731
+ // }
732
+ //
733
+ const instId = this.safeString(trade, 'instId');
734
+ if (market === undefined) {
735
+ market = this.safeMarket(instId, undefined, undefined, 'contract');
736
+ }
737
+ const timestamp = this.safeIntegerN(trade, ['uTime', 'cTime', 'ts']);
738
+ const feeCost = this.safeString(trade, 'fillFee');
739
+ let fee = undefined;
740
+ if (feeCost !== undefined) {
741
+ const feeCurrencyId = this.safeString(trade, 'fillFeeCoin');
742
+ const feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId);
743
+ fee = {
744
+ 'cost': Precise.stringAbs(feeCost),
745
+ 'currency': feeCurrencyCode,
746
+ };
747
+ }
693
748
  return this.safeTrade({
694
749
  'info': trade,
695
750
  'id': this.safeString(trade, 'tradeId'),
696
- 'order': undefined,
751
+ 'order': this.safeString(trade, 'orderId'),
697
752
  'timestamp': timestamp,
698
753
  'datetime': this.iso8601(timestamp),
699
754
  'symbol': market['symbol'],
700
755
  'type': undefined,
701
756
  'side': this.safeString(trade, 'side'),
702
757
  'takerOrMaker': undefined,
703
- 'price': this.safeString(trade, 'price'),
758
+ 'price': this.safeString2(trade, 'priceAvg', 'price'),
704
759
  'amount': this.safeString(trade, 'size'),
705
- 'cost': undefined,
706
- 'fee': undefined,
760
+ 'cost': this.safeString(trade, 'fillNotionalUsd'),
761
+ 'fee': fee,
707
762
  }, market);
708
763
  }
709
764
  async watchPositions(symbols = undefined, since = undefined, limit = undefined, params = {}) {
@@ -1108,6 +1163,9 @@ export default class bitget extends bitgetRest {
1108
1163
  const marketSymbols = {};
1109
1164
  for (let i = 0; i < data.length; i++) {
1110
1165
  const order = data[i];
1166
+ if ('tradeId' in order) {
1167
+ this.handleMyTrades(client, order);
1168
+ }
1111
1169
  const marketId = this.safeString(order, 'instId');
1112
1170
  const market = this.safeMarket(marketId, undefined, undefined, marketType);
1113
1171
  const parsed = this.parseWsOrder(order, market);
@@ -1373,7 +1431,7 @@ export default class bitget extends bitgetRest {
1373
1431
  this.myTrades = new ArrayCache(limit);
1374
1432
  }
1375
1433
  const stored = this.myTrades;
1376
- const parsed = this.parseWsMyTrade(message);
1434
+ const parsed = this.parseWsTrade(message);
1377
1435
  stored.append(parsed);
1378
1436
  const symbol = parsed['symbol'];
1379
1437
  const messageHash = 'myTrades';
@@ -1381,68 +1439,6 @@ export default class bitget extends bitgetRest {
1381
1439
  const symbolSpecificMessageHash = 'myTrades:' + symbol;
1382
1440
  client.resolve(stored, symbolSpecificMessageHash);
1383
1441
  }
1384
- parseWsMyTrade(trade, market = undefined) {
1385
- //
1386
- // order and trade mixin (contract)
1387
- //
1388
- // {
1389
- // "accBaseVolume": "0",
1390
- // "cTime": "1701920553759",
1391
- // "clientOid": "1116501214318198793",
1392
- // "enterPointSource": "WEB",
1393
- // "feeDetail": [{
1394
- // "feeCoin": "USDT",
1395
- // "fee": "-0.162003"
1396
- // }],
1397
- // "force": "gtc",
1398
- // "instId": "BTCUSDT",
1399
- // "leverage": "20",
1400
- // "marginCoin": "USDT",
1401
- // "marginMode": "isolated",
1402
- // "notionalUsd": "105",
1403
- // "orderId": "1116501214293032964",
1404
- // "orderType": "limit",
1405
- // "posMode": "hedge_mode",
1406
- // "posSide": "long",
1407
- // "price": "35000",
1408
- // "reduceOnly": "no",
1409
- // "side": "buy",
1410
- // "size": "0.003",
1411
- // "status": "canceled",
1412
- // "tradeSide": "open",
1413
- // "uTime": "1701920595866"
1414
- // }
1415
- //
1416
- const marketId = this.safeString(trade, 'instId');
1417
- market = this.safeMarket(marketId, market, undefined, 'contract');
1418
- const timestamp = this.safeInteger2(trade, 'uTime', 'cTime');
1419
- const orderFee = this.safeValue(trade, 'feeDetail', []);
1420
- const fee = this.safeValue(orderFee, 0);
1421
- const feeAmount = this.safeString(fee, 'fee');
1422
- let feeObject = undefined;
1423
- if (feeAmount !== undefined) {
1424
- const feeCurrency = this.safeString(fee, 'feeCoin');
1425
- feeObject = {
1426
- 'cost': Precise.stringAbs(feeAmount),
1427
- 'currency': this.safeCurrencyCode(feeCurrency),
1428
- };
1429
- }
1430
- return this.safeTrade({
1431
- 'info': trade,
1432
- 'id': undefined,
1433
- 'order': this.safeString(trade, 'orderId'),
1434
- 'timestamp': timestamp,
1435
- 'datetime': this.iso8601(timestamp),
1436
- 'symbol': market['symbol'],
1437
- 'type': this.safeString(trade, 'orderType'),
1438
- 'side': this.safeString(trade, 'side'),
1439
- 'takerOrMaker': undefined,
1440
- 'price': this.safeString(trade, 'price'),
1441
- 'amount': this.safeString(trade, 'size'),
1442
- 'cost': this.safeString(trade, 'notionalUsd'),
1443
- 'fee': feeObject,
1444
- }, market);
1445
- }
1446
1442
  async watchBalance(params = {}) {
1447
1443
  /**
1448
1444
  * @method
@@ -331,15 +331,29 @@ export default class bybit extends bybitRest {
331
331
  // "price24hPcnt": "-0.0388"
332
332
  // }
333
333
  // }
334
+ // swap delta
335
+ // {
336
+ // "topic":"tickers.AAVEUSDT",
337
+ // "type":"delta",
338
+ // "data":{
339
+ // "symbol":"AAVEUSDT",
340
+ // "bid1Price":"112.89",
341
+ // "bid1Size":"2.12",
342
+ // "ask1Price":"112.90",
343
+ // "ask1Size":"5.02"
344
+ // },
345
+ // "cs":78039939929,
346
+ // "ts":1709210212704
347
+ // }
334
348
  //
335
349
  const topic = this.safeString(message, 'topic', '');
336
350
  const updateType = this.safeString(message, 'type', '');
337
- const data = this.safeValue(message, 'data', {});
338
- const isSpot = this.safeString(data, 'fundingRate') === undefined;
351
+ const data = this.safeDict(message, 'data', {});
352
+ const isSpot = this.safeString(data, 'usdIndexPrice') !== undefined;
339
353
  const type = isSpot ? 'spot' : 'contract';
340
354
  let symbol = undefined;
341
355
  let parsed = undefined;
342
- if ((updateType === 'snapshot') || isSpot) {
356
+ if ((updateType === 'snapshot')) {
343
357
  parsed = this.parseTicker(data);
344
358
  symbol = parsed['symbol'];
345
359
  }
@@ -350,8 +364,8 @@ export default class bybit extends bybitRest {
350
364
  const market = this.safeMarket(marketId, undefined, undefined, type);
351
365
  symbol = market['symbol'];
352
366
  // update the info in place
353
- const ticker = this.safeValue(this.tickers, symbol, {});
354
- const rawTicker = this.safeValue(ticker, 'info', {});
367
+ const ticker = this.safeDict(this.tickers, symbol, {});
368
+ const rawTicker = this.safeDict(ticker, 'info', {});
355
369
  const merged = this.extend(rawTicker, data);
356
370
  parsed = this.parseTicker(merged);
357
371
  }
@@ -93,7 +93,7 @@ export default class currencycom extends currencycomRest {
93
93
  // "accountId": 5470310874305732,
94
94
  // "collateralCurrency": true,
95
95
  // "asset": "USD",
96
- // "free": 47.82576735,
96
+ // "free": 47.82576736,
97
97
  // "locked": 1.187925,
98
98
  // "default": true
99
99
  // },
@@ -463,6 +463,7 @@ export default class currencycom extends currencycomRest {
463
463
  orderbook = this.orderBook();
464
464
  }
465
465
  orderbook.reset({
466
+ 'symbol': symbol,
466
467
  'timestamp': timestamp,
467
468
  'datetime': this.iso8601(timestamp),
468
469
  });
@@ -358,7 +358,7 @@ export default class kraken extends krakenRest {
358
358
  // [
359
359
  // 0, // channelID
360
360
  // [ // price volume time side type misc
361
- // [ "5541.20000", "0.15850568", "1534614057.321597", "s", "l", "" ],
361
+ // [ "5541.20000", "0.15850568", "1534614057.321596", "s", "l", "" ],
362
362
  // [ "6060.00000", "0.02455000", "1534614057.324998", "b", "l", "" ],
363
363
  // ],
364
364
  // "trade",
package/js/src/upbit.js CHANGED
@@ -619,7 +619,7 @@ export default class upbit extends Exchange {
619
619
  // "trade_time": "104543",
620
620
  // "trade_date_kst": "20181122",
621
621
  // "trade_time_kst": "194543",
622
- // "trade_timestamp": 1542883543097,
622
+ // "trade_timestamp": 1542883543096,
623
623
  // "opening_price": 0.02976455,
624
624
  // "high_price": 0.02992577,
625
625
  // "low_price": 0.02934283,
package/js/src/woo.d.ts CHANGED
@@ -157,6 +157,7 @@ export default class woo extends Exchange {
157
157
  }>;
158
158
  fetchFundingRates(symbols?: Strings, params?: {}): Promise<any>;
159
159
  fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
160
+ setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<any>;
160
161
  fetchLeverage(symbol: string, params?: {}): Promise<{
161
162
  info: any;
162
163
  leverage: number;
package/js/src/woo.js CHANGED
@@ -100,6 +100,7 @@ export default class woo extends Exchange {
100
100
  'reduceMargin': false,
101
101
  'setLeverage': true,
102
102
  'setMargin': false,
103
+ 'setPositionMode': true,
103
104
  'transfer': true,
104
105
  'withdraw': true, // exchange have that endpoint disabled atm, but was once implemented in ccxt per old docs: https://kronosresearch.github.io/wootrade-documents/#token-withdraw
105
106
  },
@@ -174,10 +175,16 @@ export default class woo extends Exchange {
174
175
  'client/trade/{tid}': 1,
175
176
  'order/{oid}/trades': 1,
176
177
  'client/trades': 1,
178
+ 'client/hist_trades': 1,
179
+ 'staking/yield_history': 1,
180
+ 'client/holding': 1,
177
181
  'asset/deposit': 10,
178
182
  'asset/history': 60,
179
183
  'sub_account/all': 60,
180
184
  'sub_account/assets': 60,
185
+ 'sub_account/asset_detail': 60,
186
+ 'sub_account/ip_restriction': 10,
187
+ 'asset/main_sub_transfer_history': 30,
181
188
  'token_interest': 60,
182
189
  'token_interest/{token}': 60,
183
190
  'interest/history': 60,
@@ -190,9 +197,12 @@ export default class woo extends Exchange {
190
197
  'post': {
191
198
  'order': 5,
192
199
  'asset/main_sub_transfer': 30,
200
+ 'asset/ltv': 30,
193
201
  'asset/withdraw': 30,
202
+ 'asset/internal_withdraw': 30,
194
203
  'interest/repay': 60,
195
204
  'client/account_mode': 120,
205
+ 'client/position_mode': 5,
196
206
  'client/leverage': 120,
197
207
  },
198
208
  'delete': {
@@ -2614,6 +2624,37 @@ export default class woo extends Exchange {
2614
2624
  const sorted = this.sortBy(rates, 'timestamp');
2615
2625
  return this.filterBySymbolSinceLimit(sorted, symbol, since, limit);
2616
2626
  }
2627
+ async setPositionMode(hedged, symbol = undefined, params = {}) {
2628
+ /**
2629
+ * @method
2630
+ * @name woo#setPositionMode
2631
+ * @description set hedged to true or false for a market
2632
+ * @see https://docs.woo.org/#update-position-mode
2633
+ * @param {bool} hedged set to true to use HEDGE_MODE, false for ONE_WAY
2634
+ * @param {string} symbol not used by woo setPositionMode
2635
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2636
+ * @returns {object} response from the exchange
2637
+ */
2638
+ let hedgeMode = undefined;
2639
+ if (hedged) {
2640
+ hedgeMode = 'HEDGE_MODE';
2641
+ }
2642
+ else {
2643
+ hedgeMode = 'ONE_WAY';
2644
+ }
2645
+ const request = {
2646
+ 'position_mode': hedgeMode,
2647
+ };
2648
+ const response = await this.v1PrivatePostClientPositionMode(this.extend(request, params));
2649
+ //
2650
+ // {
2651
+ // "success": true,
2652
+ // "data": {},
2653
+ // "timestamp": "1709195608551"
2654
+ // }
2655
+ //
2656
+ return response;
2657
+ }
2617
2658
  async fetchLeverage(symbol, params = {}) {
2618
2659
  await this.loadMarkets();
2619
2660
  const response = await this.v3PrivateGetAccountinfo(params);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.2.54",
3
+ "version": "4.2.56",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",