ccxt 4.2.79 → 4.2.80

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.
@@ -771,6 +771,8 @@ export default class hyperliquid extends Exchange {
771
771
  */
772
772
  await this.loadMarkets();
773
773
  const market = this.market(symbol);
774
+ const vaultAddress = this.safeString(params, 'vaultAddress');
775
+ params = this.omit(params, 'vaultAddress');
774
776
  symbol = market['symbol'];
775
777
  const order = {
776
778
  'symbol': symbol,
@@ -780,7 +782,11 @@ export default class hyperliquid extends Exchange {
780
782
  'price': price,
781
783
  'params': params,
782
784
  };
783
- const response = await this.createOrders([order], params);
785
+ const globalParams = {};
786
+ if (vaultAddress !== undefined) {
787
+ globalParams['vaultAddress'] = vaultAddress;
788
+ }
789
+ const response = await this.createOrders([order], globalParams);
784
790
  const first = this.safeDict(response, 0);
785
791
  return first;
786
792
  }
@@ -831,7 +837,6 @@ export default class hyperliquid extends Exchange {
831
837
  const amount = this.safeString(rawOrder, 'amount');
832
838
  const price = this.safeString(rawOrder, 'price');
833
839
  let orderParams = this.safeDict(rawOrder, 'params', {});
834
- orderParams = this.extend(params, orderParams);
835
840
  const clientOrderId = this.safeString2(orderParams, 'clientOrderId', 'client_id');
836
841
  const slippage = this.safeString(orderParams, 'slippage', defaultSlippage);
837
842
  let defaultTimeInForce = (isMarket) ? 'ioc' : 'gtc';
@@ -879,6 +884,7 @@ export default class hyperliquid extends Exchange {
879
884
  'tif': timeInForce,
880
885
  };
881
886
  }
887
+ orderParams = this.omit(orderParams, ['clientOrderId', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce', 'client_id']);
882
888
  const orderObj = {
883
889
  'a': this.parseToInt(market['baseId']),
884
890
  'b': isBuy,
@@ -891,9 +897,9 @@ export default class hyperliquid extends Exchange {
891
897
  if (clientOrderId !== undefined) {
892
898
  orderObj['c'] = clientOrderId;
893
899
  }
894
- orderReq.push(orderObj);
900
+ orderReq.push(this.extend(orderObj, orderParams));
895
901
  }
896
- const vaultAddress = this.safeString(params, 'vaultAddress');
902
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
897
903
  const orderAction = {
898
904
  'type': 'order',
899
905
  'orders': orderReq,
@@ -910,6 +916,10 @@ export default class hyperliquid extends Exchange {
910
916
  'signature': signature,
911
917
  // 'vaultAddress': vaultAddress,
912
918
  };
919
+ if (vaultAddress !== undefined) {
920
+ params = this.omit(params, 'vaultAddress');
921
+ request['vaultAddress'] = vaultAddress;
922
+ }
913
923
  const response = await this.privatePostExchange(this.extend(request, params));
914
924
  //
915
925
  // {
@@ -1002,10 +1012,14 @@ export default class hyperliquid extends Exchange {
1002
1012
  }
1003
1013
  }
1004
1014
  cancelAction['cancels'] = cancelReq;
1005
- const vaultAddress = this.safeString(params, 'vaultAddress');
1015
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
1006
1016
  const signature = this.signL1Action(cancelAction, nonce, vaultAddress);
1007
1017
  request['action'] = cancelAction;
1008
1018
  request['signature'] = signature;
1019
+ if (vaultAddress !== undefined) {
1020
+ params = this.omit(params, 'vaultAddress');
1021
+ request['vaultAddress'] = vaultAddress;
1022
+ }
1009
1023
  const response = await this.privatePostExchange(this.extend(request, params));
1010
1024
  //
1011
1025
  // {
@@ -1123,7 +1137,7 @@ export default class hyperliquid extends Exchange {
1123
1137
  'type': 'batchModify',
1124
1138
  'modifies': [modifyReq],
1125
1139
  };
1126
- const vaultAddress = this.safeString(params, 'vaultAddress');
1140
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
1127
1141
  const signature = this.signL1Action(modifyAction, nonce, vaultAddress);
1128
1142
  const request = {
1129
1143
  'action': modifyAction,
@@ -1131,6 +1145,10 @@ export default class hyperliquid extends Exchange {
1131
1145
  'signature': signature,
1132
1146
  // 'vaultAddress': vaultAddress,
1133
1147
  };
1148
+ if (vaultAddress !== undefined) {
1149
+ params = this.omit(params, 'vaultAddress');
1150
+ request['vaultAddress'] = vaultAddress;
1151
+ }
1134
1152
  const response = await this.privatePostExchange(this.extend(request, params));
1135
1153
  //
1136
1154
  // {
@@ -1729,7 +1747,7 @@ export default class hyperliquid extends Exchange {
1729
1747
  'isolated': isIsolated,
1730
1748
  'hedged': undefined,
1731
1749
  'side': side,
1732
- 'contracts': this.parseNumber(quantity),
1750
+ 'contracts': this.safeNumber(entry, 'szi'),
1733
1751
  'contractSize': undefined,
1734
1752
  'entryPrice': this.safeNumber(entry, 'entryPx'),
1735
1753
  'markPrice': undefined,
@@ -1776,7 +1794,13 @@ export default class hyperliquid extends Exchange {
1776
1794
  'isCross': isCross,
1777
1795
  'leverage': leverage,
1778
1796
  };
1779
- const vaultAddress = this.safeString(params, 'vaultAddress');
1797
+ let vaultAddress = this.safeString(params, 'vaultAddress');
1798
+ if (vaultAddress !== undefined) {
1799
+ params = this.omit(params, 'vaultAddress');
1800
+ if (vaultAddress.startsWith('0x')) {
1801
+ vaultAddress = vaultAddress.replace('0x', '');
1802
+ }
1803
+ }
1780
1804
  const signature = this.signL1Action(updateAction, nonce, vaultAddress);
1781
1805
  const request = {
1782
1806
  'action': updateAction,
@@ -1784,6 +1808,9 @@ export default class hyperliquid extends Exchange {
1784
1808
  'signature': signature,
1785
1809
  // 'vaultAddress': vaultAddress,
1786
1810
  };
1811
+ if (vaultAddress !== undefined) {
1812
+ request['vaultAddress'] = vaultAddress;
1813
+ }
1787
1814
  const response = await this.privatePostExchange(this.extend(request, params));
1788
1815
  //
1789
1816
  // {
@@ -1822,7 +1849,7 @@ export default class hyperliquid extends Exchange {
1822
1849
  'isCross': isCross,
1823
1850
  'leverage': leverage,
1824
1851
  };
1825
- const vaultAddress = this.safeString(params, 'vaultAddress');
1852
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
1826
1853
  const signature = this.signL1Action(updateAction, nonce, vaultAddress);
1827
1854
  const request = {
1828
1855
  'action': updateAction,
@@ -1830,6 +1857,10 @@ export default class hyperliquid extends Exchange {
1830
1857
  'signature': signature,
1831
1858
  // 'vaultAddress': vaultAddress,
1832
1859
  };
1860
+ if (vaultAddress !== undefined) {
1861
+ params = this.omit(params, 'vaultAddress');
1862
+ request['vaultAddress'] = vaultAddress;
1863
+ }
1833
1864
  const response = await this.privatePostExchange(this.extend(request, params));
1834
1865
  //
1835
1866
  // {
@@ -1882,7 +1913,7 @@ export default class hyperliquid extends Exchange {
1882
1913
  'isBuy': true,
1883
1914
  'ntli': sz,
1884
1915
  };
1885
- const vaultAddress = this.safeString(params, 'vaultAddress');
1916
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
1886
1917
  const signature = this.signL1Action(updateAction, nonce, vaultAddress);
1887
1918
  const request = {
1888
1919
  'action': updateAction,
@@ -1890,6 +1921,10 @@ export default class hyperliquid extends Exchange {
1890
1921
  'signature': signature,
1891
1922
  // 'vaultAddress': vaultAddress,
1892
1923
  };
1924
+ if (vaultAddress !== undefined) {
1925
+ params = this.omit(params, 'vaultAddress');
1926
+ request['vaultAddress'] = vaultAddress;
1927
+ }
1893
1928
  const response = await this.privatePostExchange(this.extend(request, params));
1894
1929
  //
1895
1930
  // {
@@ -1988,6 +2023,15 @@ export default class hyperliquid extends Exchange {
1988
2023
  const response = await this.privatePostExchange(this.extend(request, params));
1989
2024
  return response;
1990
2025
  }
2026
+ formatVaultAddress(address = undefined) {
2027
+ if (address === undefined) {
2028
+ return undefined;
2029
+ }
2030
+ if (address.startsWith('0x')) {
2031
+ return address.replace('0x', '');
2032
+ }
2033
+ return address;
2034
+ }
1991
2035
  handlePublicAddress(methodName, params) {
1992
2036
  let userAux = undefined;
1993
2037
  [userAux, params] = this.handleOptionAndParams(params, methodName, 'user');
@@ -87,7 +87,7 @@ export default class binance extends binanceRest {
87
87
  'future': 200,
88
88
  'delivery': 200,
89
89
  },
90
- 'streamBySubscriptionsHash': {},
90
+ 'streamBySubscriptionsHash': this.createSafeDictionary(),
91
91
  'streamIndex': -1,
92
92
  // get updates every 1000ms or 100ms
93
93
  // or every 0ms in real-time for futures
@@ -95,7 +95,7 @@ export default class binance extends binanceRest {
95
95
  'tradesLimit': 1000,
96
96
  'ordersLimit': 1000,
97
97
  'OHLCVLimit': 1000,
98
- 'requestId': {},
98
+ 'requestId': this.createSafeDictionary(),
99
99
  'watchOrderBookLimit': 1000,
100
100
  'watchTrades': {
101
101
  'name': 'trade', // 'trade' or 'aggTrade'
@@ -129,14 +129,14 @@ export default class binance extends binanceRest {
129
129
  });
130
130
  }
131
131
  requestId(url) {
132
- const options = this.safeValue(this.options, 'requestId', {});
132
+ const options = this.safeDict(this.options, 'requestId', this.createSafeDictionary());
133
133
  const previousValue = this.safeInteger(options, url, 0);
134
134
  const newValue = this.sum(previousValue, 1);
135
135
  this.options['requestId'][url] = newValue;
136
136
  return newValue;
137
137
  }
138
138
  stream(type, subscriptionHash, numSubscriptions = 1) {
139
- const streamBySubscriptionsHash = this.safeValue(this.options, 'streamBySubscriptionsHash', {});
139
+ const streamBySubscriptionsHash = this.safeDict(this.options, 'streamBySubscriptionsHash', this.createSafeDictionary());
140
140
  let stream = this.safeString(streamBySubscriptionsHash, subscriptionHash);
141
141
  if (stream === undefined) {
142
142
  let streamIndex = this.safeInteger(this.options, 'streamIndex', -1);
@@ -149,7 +149,7 @@ export default class binance extends binanceRest {
149
149
  this.options['streamBySubscriptionsHash'][subscriptionHash] = stream;
150
150
  const subscriptionsByStreams = this.safeValue(this.options, 'numSubscriptionsByStream');
151
151
  if (subscriptionsByStreams === undefined) {
152
- this.options['numSubscriptionsByStream'] = {};
152
+ this.options['numSubscriptionsByStream'] = this.createSafeDictionary();
153
153
  }
154
154
  const subscriptionsByStream = this.safeInteger(this.options['numSubscriptionsByStream'], stream, 0);
155
155
  const newNumSubscriptions = subscriptionsByStream + numSubscriptions;
@@ -388,7 +388,8 @@ export default class bitopro extends bitoproRest {
388
388
  },
389
389
  },
390
390
  };
391
- this.options = this.extend(defaultOptions, this.options);
391
+ // this.options = this.extend (defaultOptions, this.options);
392
+ this.extendExchangeOptions(defaultOptions);
392
393
  const originalHeaders = this.options['ws']['options']['headers'];
393
394
  const headers = {
394
395
  'X-BITOPRO-API': 'ccxt',
@@ -1,5 +1,5 @@
1
1
  import geminiRest from '../gemini.js';
2
- import type { Int, Str, OrderBook, Order, Trade, OHLCV, Tickers } from '../base/types.js';
2
+ import type { Int, Str, Strings, OrderBook, Order, Trade, OHLCV, Tickers } from '../base/types.js';
3
3
  import Client from '../base/ws/Client.js';
4
4
  export default class gemini extends geminiRest {
5
5
  describe(): any;
@@ -14,7 +14,7 @@ export default class gemini extends geminiRest {
14
14
  watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
15
15
  handleOrderBook(client: Client, message: any): void;
16
16
  watchOrderBookForSymbols(symbols: string[], limit?: Int, params?: {}): Promise<OrderBook>;
17
- watchBidsAsks(symbols: string[], limit?: Int, params?: {}): Promise<Tickers>;
17
+ watchBidsAsks(symbols?: Strings, params?: {}): Promise<Tickers>;
18
18
  handleBidsAsksForMultidata(client: Client, rawBidAskChanges: any, timestamp: Int, nonce: Int): void;
19
19
  helperForWatchMultipleConstruct(itemHashName: string, symbols: string[], params?: {}): Promise<any>;
20
20
  handleOrderBookForMultidata(client: Client, rawOrderBookChanges: any, timestamp: Int, nonce: Int): void;
@@ -418,7 +418,7 @@ export default class gemini extends geminiRest {
418
418
  const orderbook = await this.helperForWatchMultipleConstruct('orderbook', symbols, params);
419
419
  return orderbook.limit();
420
420
  }
421
- async watchBidsAsks(symbols, limit = undefined, params = {}) {
421
+ async watchBidsAsks(symbols = undefined, params = {}) {
422
422
  /**
423
423
  * @method
424
424
  * @name gemini#watchBidsAsks
@@ -914,7 +914,8 @@ export default class gemini extends geminiRest {
914
914
  },
915
915
  },
916
916
  };
917
- this.options = this.extend(defaultOptions, this.options);
917
+ // this.options = this.extend (defaultOptions, this.options);
918
+ this.extendExchangeOptions(defaultOptions);
918
919
  const originalHeaders = this.options['ws']['options']['headers'];
919
920
  const headers = {
920
921
  'X-GEMINI-APIKEY': this.apiKey,
@@ -23,7 +23,11 @@ export default class phemex extends phemexRest {
23
23
  'watchOrders': true,
24
24
  'watchOrderBook': true,
25
25
  'watchOHLCV': true,
26
- 'watchPositions': undefined, // TODO
26
+ 'watchPositions': undefined,
27
+ // mutli-endpoints are not supported: https://github.com/ccxt/ccxt/pull/21490
28
+ 'watchOrderBookForSymbols': false,
29
+ 'watchTradesForSymbols': false,
30
+ 'watchOHLCVForSymbols': false,
27
31
  },
28
32
  'urls': {
29
33
  'test': {
@@ -563,9 +567,10 @@ export default class phemex extends phemexRest {
563
567
  /**
564
568
  * @method
565
569
  * @name phemex#watchOrderBook
570
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-orderbook
566
571
  * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-orderbook-for-new-model
567
572
  * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-30-levels-orderbook
568
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-orderbook
573
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-full-orderbook
569
574
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
570
575
  * @param {string} symbol unified symbol of the market to fetch the order book for
571
576
  * @param {int} [limit] the maximum amount of order book entries to return
package/js/src/upbit.js CHANGED
@@ -81,6 +81,7 @@ export default class upbit extends Exchange {
81
81
  '1m': 'minutes',
82
82
  '3m': 'minutes',
83
83
  '5m': 'minutes',
84
+ '10m': 'minutes',
84
85
  '15m': 'minutes',
85
86
  '30m': 'minutes',
86
87
  '1h': 'minutes',
@@ -110,6 +111,7 @@ export default class upbit extends Exchange {
110
111
  'candles/minutes/1',
111
112
  'candles/minutes/3',
112
113
  'candles/minutes/5',
114
+ 'candles/minutes/10',
113
115
  'candles/minutes/15',
114
116
  'candles/minutes/30',
115
117
  'candles/minutes/60',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.2.79",
3
+ "version": "4.2.80",
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",
package/skip-tests.json CHANGED
@@ -265,6 +265,9 @@
265
265
  "watchTrades":{
266
266
  "side": "not set https://app.travis-ci.com/github/ccxt/ccxt/builds/267900037#L4312",
267
267
  "timestamp": "messed order coming from exchange"
268
+ },
269
+ "ohlcv": {
270
+ "roundTimestamp": "are not rounded: https://app.travis-ci.com/github/ccxt/ccxt/builds/269583057#L4318"
268
271
  }
269
272
  }
270
273
  },
@@ -625,7 +628,7 @@
625
628
  }
626
629
  },
627
630
  "cex": {
628
- "skipWs": "timeouts",
631
+ "preferredSpotSymbol": "BTC/USD",
629
632
  "skipMethods": {
630
633
  "proxies": "probably they do not permit our proxy location",
631
634
  "loadMarkets": {
@@ -639,6 +642,7 @@
639
642
  "deposit": "not provided",
640
643
  "networks": "missing"
641
644
  },
645
+ "watchOHLCV": "does not work for 1min",
642
646
  "fetchOHLCV": "unexpected issue"
643
647
  }
644
648
  },
@@ -1394,7 +1398,8 @@
1394
1398
  "loadMarkets": {
1395
1399
  "taker": "is undefined",
1396
1400
  "maker": "is undefined",
1397
- "currencyIdAndCode": "not all currencies are available"
1401
+ "currencyIdAndCode": "not all currencies are available",
1402
+ "contractSize": "returns zero for BTC/USDT:USDT https://app.travis-ci.com/github/ccxt/ccxt/builds/269614608#L3778"
1398
1403
  },
1399
1404
  "fetchTrades": {
1400
1405
  "side": "undefined"