ccxt 4.2.20 → 4.2.21

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.
@@ -529,6 +529,7 @@ class gate extends gate$1 {
529
529
  'multi_collateral/currency_quota': 20 / 15,
530
530
  'multi_collateral/currencies': 20 / 15,
531
531
  'multi_collateral/ltv': 20 / 15,
532
+ 'multi_collateral/fixed_rate': 20 / 15,
532
533
  },
533
534
  'post': {
534
535
  'collateral/orders': 20 / 15,
@@ -5558,7 +5559,7 @@ class gate extends gate$1 {
5558
5559
  * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
5559
5560
  * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
5560
5561
  * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts-2
5561
- * @param {string[]|undefined} symbols list of unified market symbols
5562
+ * @param {string[]} [symbols] list of unified market symbols
5562
5563
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5563
5564
  * @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
5564
5565
  */
@@ -5703,6 +5704,33 @@ class gate extends gate$1 {
5703
5704
  //
5704
5705
  return this.parseMarketLeverageTiers(response, market);
5705
5706
  }
5707
+ parseEmulatedLeverageTiers(info, market = undefined) {
5708
+ const maintenanceMarginUnit = this.safeString(info, 'maintenance_rate'); // '0.005',
5709
+ const leverageMax = this.safeString(info, 'leverage_max'); // '100',
5710
+ const riskLimitStep = this.safeString(info, 'risk_limit_step'); // '1000000',
5711
+ const riskLimitMax = this.safeString(info, 'risk_limit_max'); // '16000000',
5712
+ const initialMarginUnit = Precise["default"].stringDiv('1', leverageMax);
5713
+ let maintenanceMarginRate = maintenanceMarginUnit;
5714
+ let initialMarginRatio = initialMarginUnit;
5715
+ let floor = '0';
5716
+ const tiers = [];
5717
+ while (Precise["default"].stringLt(floor, riskLimitMax)) {
5718
+ const cap = Precise["default"].stringAdd(floor, riskLimitStep);
5719
+ tiers.push({
5720
+ 'tier': this.parseNumber(Precise["default"].stringDiv(cap, riskLimitStep)),
5721
+ 'currency': this.safeString(market, 'settle'),
5722
+ 'minNotional': this.parseNumber(floor),
5723
+ 'maxNotional': this.parseNumber(cap),
5724
+ 'maintenanceMarginRate': this.parseNumber(maintenanceMarginRate),
5725
+ 'maxLeverage': this.parseNumber(Precise["default"].stringDiv('1', initialMarginRatio)),
5726
+ 'info': info,
5727
+ });
5728
+ maintenanceMarginRate = Precise["default"].stringAdd(maintenanceMarginRate, maintenanceMarginUnit);
5729
+ initialMarginRatio = Precise["default"].stringAdd(initialMarginRatio, initialMarginUnit);
5730
+ floor = cap;
5731
+ }
5732
+ return tiers;
5733
+ }
5706
5734
  parseMarketLeverageTiers(info, market = undefined) {
5707
5735
  //
5708
5736
  // [
@@ -5715,6 +5743,9 @@ class gate extends gate$1 {
5715
5743
  // }
5716
5744
  // ]
5717
5745
  //
5746
+ if (!Array.isArray(info)) {
5747
+ return this.parseEmulatedLeverageTiers(info, market);
5748
+ }
5718
5749
  let minNotional = 0;
5719
5750
  const tiers = [];
5720
5751
  for (let i = 0; i < info.length; i++) {
@@ -19,9 +19,9 @@ class novadax extends novadax$1 {
19
19
  'id': 'novadax',
20
20
  'name': 'NovaDAX',
21
21
  'countries': ['BR'],
22
- // 60 requests per second = 1000ms / 60 = 16.6667ms between requests (public endpoints, limited by IP address)
23
- // 20 requests per second => cost = 60 / 20 = 3 (private endpoints, limited by API Key)
24
- 'rateLimit': 16.6667,
22
+ // 6000 weight per min => 100 weight per second => min weight = 1
23
+ // 100 requests per second => ( 1000ms / 100 ) = 10 ms between requests on average
24
+ 'rateLimit': 10,
25
25
  'version': 'v1',
26
26
  // new metainfo interface
27
27
  'has': {
@@ -119,33 +119,37 @@ class novadax extends novadax$1 {
119
119
  'api': {
120
120
  'public': {
121
121
  'get': {
122
- 'common/symbol': 1.2,
123
- 'common/symbols': 1.2,
124
- 'common/timestamp': 1.2,
125
- 'market/tickers': 1.2,
126
- 'market/ticker': 1.2,
127
- 'market/depth': 1.2,
128
- 'market/trades': 1.2,
129
- 'market/kline/history': 1.2,
122
+ 'common/symbol': 1,
123
+ 'common/symbols': 1,
124
+ 'common/timestamp': 1,
125
+ 'market/tickers': 5,
126
+ 'market/ticker': 1,
127
+ 'market/depth': 1,
128
+ 'market/trades': 5,
129
+ 'market/kline/history': 5,
130
130
  },
131
131
  },
132
132
  'private': {
133
133
  'get': {
134
- 'orders/get': 3,
135
- 'orders/list': 3,
134
+ 'orders/get': 1,
135
+ 'orders/list': 10,
136
136
  'orders/fill': 3,
137
- 'orders/fills': 3,
138
- 'account/getBalance': 3,
139
- 'account/subs': 3,
140
- 'account/subs/balance': 3,
141
- 'account/subs/transfer/record': 3,
137
+ 'orders/fills': 10,
138
+ 'account/getBalance': 1,
139
+ 'account/subs': 1,
140
+ 'account/subs/balance': 1,
141
+ 'account/subs/transfer/record': 10,
142
142
  'wallet/query/deposit-withdraw': 3,
143
143
  },
144
144
  'post': {
145
- 'orders/create': 3,
146
- 'orders/cancel': 3,
147
- 'account/withdraw/coin': 3,
148
- 'account/subs/transfer': 3,
145
+ 'orders/create': 5,
146
+ 'orders/batch-create': 50,
147
+ 'orders/cancel': 1,
148
+ 'orders/batch-cancel': 10,
149
+ 'orders/cancel-by-symbol': 10,
150
+ 'account/subs/transfer': 5,
151
+ 'wallet/withdraw/coin': 3,
152
+ 'account/withdraw/coin': 3, // not found in doc
149
153
  },
150
154
  },
151
155
  },
@@ -190,6 +190,7 @@ class phemex extends phemex$1 {
190
190
  'api-data/g-futures/trades': 5,
191
191
  'api-data/futures/trading-fees': 5,
192
192
  'api-data/g-futures/trading-fees': 5,
193
+ 'api-data/futures/v2/tradeAccountDetail': 5,
193
194
  'g-orders/activeList': 1,
194
195
  'orders/activeList': 1,
195
196
  'exchange/order/list': 5,
@@ -2767,7 +2768,7 @@ class phemex extends phemex$1 {
2767
2768
  }
2768
2769
  else if (amount !== undefined) {
2769
2770
  if (isUSDTSettled) {
2770
- request['baseQtyEV'] = this.amountToPrecision(market['symbol'], amount);
2771
+ request['orderQtyRq'] = this.amountToPrecision(market['symbol'], amount);
2771
2772
  }
2772
2773
  else {
2773
2774
  request['baseQtyEV'] = this.toEv(amount, market);
@@ -23,8 +23,8 @@ class bitopro extends bitopro$1 {
23
23
  },
24
24
  'urls': {
25
25
  'ws': {
26
- 'public': 'wss://stream.bitopro.com:9443/ws/v1/pub',
27
- 'private': 'wss://stream.bitopro.com:9443/ws/v1/pub/auth',
26
+ 'public': 'wss://stream.bitopro.com:443/ws/v1/pub',
27
+ 'private': 'wss://stream.bitopro.com:443/ws/v1/pub/auth',
28
28
  },
29
29
  },
30
30
  'requiredCredentials': {
@@ -53,6 +53,7 @@ class bitopro extends bitopro$1 {
53
53
  * @method
54
54
  * @name bitopro#watchOrderBook
55
55
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
56
+ * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/public/order_book_stream.md
56
57
  * @param {string} symbol unified symbol of the market to fetch the order book for
57
58
  * @param {int} [limit] the maximum amount of order book entries to return
58
59
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -118,6 +119,7 @@ class bitopro extends bitopro$1 {
118
119
  * @method
119
120
  * @name bitopro#watchTrades
120
121
  * @description get the list of most recent trades for a particular symbol
122
+ * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/public/trade_stream.md
121
123
  * @param {string} symbol unified symbol of the market to fetch trades for
122
124
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
123
125
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -177,6 +179,7 @@ class bitopro extends bitopro$1 {
177
179
  * @method
178
180
  * @name bitopro#watchTicker
179
181
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
182
+ * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/public/ticker_stream.md
180
183
  * @param {string} symbol unified symbol of the market to fetch the ticker for
181
184
  * @param {object} [params] extra parameters specific to the exchange API endpoint
182
185
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -230,7 +233,7 @@ class bitopro extends bitopro$1 {
230
233
  'identity': this.login,
231
234
  });
232
235
  const payload = this.stringToBase64(rawData);
233
- const signature = this.hmac(payload, this.encode(this.secret), sha512.sha384);
236
+ const signature = this.hmac(this.encode(payload), this.encode(this.secret), sha512.sha384);
234
237
  const defaultOptions = {
235
238
  'ws': {
236
239
  'options': {
@@ -256,6 +259,7 @@ class bitopro extends bitopro$1 {
256
259
  * @method
257
260
  * @name bitopro#watchBalance
258
261
  * @description watch balance and get the amount of funds available for trading or funds locked in orders
262
+ * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/private/user_balance_stream.md
259
263
  * @param {object} [params] extra parameters specific to the exchange API endpoint
260
264
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
261
265
  */