ccxt-ir 4.24.0 → 4.24.1
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/README.md +3 -3
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +262 -262
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/src/abstract/balinex.js +1 -1
- package/dist/cjs/src/balinex.js +217 -217
- package/dist/cjs/src/bitbarg.js +322 -322
- package/dist/cjs/src/bitpin.js +34 -24
- package/dist/cjs/src/nobitex.js +25 -26
- package/dist/cjs/src/swapwallet.js +209 -209
- package/dist/cjs/src/wallex.js +105 -18
- package/js/ccxt.d.ts +772 -772
- package/js/ccxt.js +557 -557
- package/js/src/abstract/balinex.d.ts +8 -8
- package/js/src/abstract/balinex.js +5 -5
- package/js/src/abstract/swapwallet.js +5 -5
- package/js/src/abstract/wallex.d.ts +2 -0
- package/js/src/balinex.d.ts +20 -20
- package/js/src/balinex.js +220 -220
- package/js/src/base/Exchange.d.ts +926 -926
- package/js/src/bitbarg.js +325 -325
- package/js/src/bitpin.d.ts +2 -2
- package/js/src/bitpin.js +34 -24
- package/js/src/coinbaseexchange.d.ts +334 -334
- package/js/src/nobitex.d.ts +2 -2
- package/js/src/nobitex.js +25 -26
- package/js/src/protobuf/mexc/compiled.d.cts +2 -8
- package/js/src/static_dependencies/fflake/browser.d.ts +222 -222
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
- package/js/src/static_dependencies/qs/formats.d.cts +8 -14
- package/js/src/static_dependencies/qs/index.d.cts +4 -10
- package/js/src/static_dependencies/qs/parse.d.cts +2 -8
- package/js/src/static_dependencies/qs/stringify.d.cts +2 -8
- package/js/src/static_dependencies/qs/utils.d.cts +9 -15
- package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
- package/js/src/swapwallet.js +212 -212
- package/js/src/wallex.d.ts +2 -2
- package/js/src/wallex.js +105 -18
- package/js/test.js +51 -62
- package/package.json +1 -1
package/dist/cjs/src/bitpin.js
CHANGED
|
@@ -79,6 +79,7 @@ class bitpin extends bitpin$1["default"] {
|
|
|
79
79
|
'fetchTradingFee': false,
|
|
80
80
|
'fetchTradingFees': false,
|
|
81
81
|
'fetchWithdrawals': false,
|
|
82
|
+
'otc': true,
|
|
82
83
|
'setLeverage': false,
|
|
83
84
|
'setMarginMode': false,
|
|
84
85
|
'transfer': false,
|
|
@@ -135,18 +136,23 @@ class bitpin extends bitpin$1["default"] {
|
|
|
135
136
|
* @description retrieves data on all markets for bitpin
|
|
136
137
|
* @see https://api-docs.bitpin.ir/#be8d9c51a2
|
|
137
138
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
139
|
+
* @param {string} [params.type] market type, 'spot' (default) or 'otc'
|
|
138
140
|
* @returns {object[]} an array of objects representing market data
|
|
139
141
|
*/
|
|
140
|
-
const
|
|
142
|
+
const type = this.safeString(params, 'type', 'spot');
|
|
143
|
+
const request = this.omit(params, ['type']);
|
|
144
|
+
const response = await this.publicGetV1MktMarkets(request);
|
|
141
145
|
const markets = this.safeList(response, 'results');
|
|
146
|
+
const tradableKey = (type === 'otc') ? 'otc_tradable' : 'tradable';
|
|
142
147
|
const result = [];
|
|
143
148
|
for (let i = 0; i < markets.length; i++) {
|
|
144
|
-
|
|
145
|
-
|
|
149
|
+
if (this.safeBool(markets[i], tradableKey, false)) {
|
|
150
|
+
result.push(this.parseMarket(markets[i], type));
|
|
151
|
+
}
|
|
146
152
|
}
|
|
147
153
|
return result;
|
|
148
154
|
}
|
|
149
|
-
parseMarket(market) {
|
|
155
|
+
parseMarket(market, type = 'spot') {
|
|
150
156
|
const id = this.safeString(market, 'id');
|
|
151
157
|
const baseCurrency = this.safeDict(market, 'currency1');
|
|
152
158
|
const quoteCurrency = this.safeDict(market, 'currency2');
|
|
@@ -156,6 +162,7 @@ class bitpin extends bitpin$1["default"] {
|
|
|
156
162
|
const quote = this.safeCurrencyCode(quoteId);
|
|
157
163
|
baseId = baseId.toLowerCase();
|
|
158
164
|
quoteId = quoteId.toLowerCase();
|
|
165
|
+
const tradableKey = (type === 'otc') ? 'otc_tradable' : 'tradable';
|
|
159
166
|
return {
|
|
160
167
|
'id': id,
|
|
161
168
|
'symbol': base + '/' + quote,
|
|
@@ -165,13 +172,13 @@ class bitpin extends bitpin$1["default"] {
|
|
|
165
172
|
'baseId': baseId,
|
|
166
173
|
'quoteId': quoteId,
|
|
167
174
|
'settleId': undefined,
|
|
168
|
-
'type':
|
|
169
|
-
'spot':
|
|
175
|
+
'type': type,
|
|
176
|
+
'spot': type === 'spot',
|
|
170
177
|
'margin': false,
|
|
171
178
|
'swap': false,
|
|
172
179
|
'future': false,
|
|
173
180
|
'option': false,
|
|
174
|
-
'active':
|
|
181
|
+
'active': this.safeBool(market, tradableKey, false),
|
|
175
182
|
'contract': false,
|
|
176
183
|
'linear': undefined,
|
|
177
184
|
'inverse': undefined,
|
|
@@ -214,19 +221,20 @@ class bitpin extends bitpin$1["default"] {
|
|
|
214
221
|
* @see https://api-docs.bitpin.ir/#be8d9c51a2
|
|
215
222
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
216
223
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
224
|
+
* @param {string} [params.type] market type, 'spot' (default) or 'otc'
|
|
217
225
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
218
226
|
*/
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
const response = await this.publicGetV1MktMarkets(params);
|
|
227
|
+
const type = this.safeString(params, 'type', 'spot');
|
|
228
|
+
const request = this.omit(params, ['type']);
|
|
229
|
+
await this.loadMarkets(false, { 'type': type });
|
|
230
|
+
const response = await this.publicGetV1MktMarkets(request);
|
|
224
231
|
const markets = this.safeList(response, 'results');
|
|
232
|
+
const tradableKey = (type === 'otc') ? 'otc_tradable' : 'tradable';
|
|
225
233
|
const result = {};
|
|
226
234
|
for (let i = 0; i < markets.length; i++) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const ticker = this.parseTicker(markets[i]);
|
|
235
|
+
if (this.safeBool(markets[i], tradableKey, false)) {
|
|
236
|
+
const market = this.parseMarket(markets[i], type);
|
|
237
|
+
const ticker = this.parseTicker(markets[i], market);
|
|
230
238
|
const symbol = ticker['symbol'];
|
|
231
239
|
result[symbol] = ticker;
|
|
232
240
|
}
|
|
@@ -241,9 +249,10 @@ class bitpin extends bitpin$1["default"] {
|
|
|
241
249
|
* @see https://api-docs.bitpin.ir/#be8d9c51a2
|
|
242
250
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
243
251
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
252
|
+
* @param {string} [params.type] market type, 'spot' (default) or 'otc'
|
|
244
253
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
245
254
|
*/
|
|
246
|
-
const ticker = await this.fetchTickers([symbol]);
|
|
255
|
+
const ticker = await this.fetchTickers([symbol], params);
|
|
247
256
|
return ticker[symbol];
|
|
248
257
|
}
|
|
249
258
|
parseTicker(ticker, market = undefined) {
|
|
@@ -360,16 +369,17 @@ class bitpin extends bitpin$1["default"] {
|
|
|
360
369
|
// 'popularity_weight': 0,
|
|
361
370
|
// 'freshness_weight': 0,
|
|
362
371
|
// }
|
|
363
|
-
const marketType = 'spot';
|
|
364
|
-
const
|
|
372
|
+
const marketType = this.safeString(market, 'type', 'spot');
|
|
373
|
+
const priceInfoKey = (marketType === 'otc') ? 'price_info' : 'order_book_info';
|
|
374
|
+
const priceInfo = this.safeDict(ticker, priceInfoKey, {});
|
|
365
375
|
const marketId = this.safeString(ticker, 'id');
|
|
366
376
|
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
367
|
-
const high = this.safeFloat(priceInfo, 'max'
|
|
368
|
-
const low = this.safeFloat(priceInfo, 'min'
|
|
369
|
-
const last = this.safeFloat(priceInfo, 'price'
|
|
370
|
-
const change = this.safeFloat(priceInfo, 'change'
|
|
371
|
-
const baseVolume = this.safeFloat(priceInfo, 'amount'
|
|
372
|
-
const quoteVolume = this.safeFloat(priceInfo, 'value'
|
|
377
|
+
const high = this.safeFloat(priceInfo, 'max');
|
|
378
|
+
const low = this.safeFloat(priceInfo, 'min');
|
|
379
|
+
const last = this.safeFloat(priceInfo, 'price');
|
|
380
|
+
const change = this.safeFloat(priceInfo, 'change');
|
|
381
|
+
const baseVolume = this.safeFloat(priceInfo, 'amount');
|
|
382
|
+
const quoteVolume = this.safeFloat(priceInfo, 'value');
|
|
373
383
|
return this.safeTicker({
|
|
374
384
|
'symbol': symbol,
|
|
375
385
|
'timestamp': undefined,
|
package/dist/cjs/src/nobitex.js
CHANGED
|
@@ -78,6 +78,7 @@ class nobitex extends nobitex$1["default"] {
|
|
|
78
78
|
'fetchTradingFee': false,
|
|
79
79
|
'fetchTradingFees': false,
|
|
80
80
|
'fetchWithdrawals': false,
|
|
81
|
+
'otc': true,
|
|
81
82
|
'setLeverage': false,
|
|
82
83
|
'setMarginMode': false,
|
|
83
84
|
'transfer': false,
|
|
@@ -137,9 +138,12 @@ class nobitex extends nobitex$1["default"] {
|
|
|
137
138
|
* @description retrieves data on all markets for nobitex
|
|
138
139
|
* @see https://apidocs.nobitex.ir/#6ae2dae4a2
|
|
139
140
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
141
|
+
* @param {string} [params.type] market type, 'spot' (default) or 'otc'; both use market/stats
|
|
140
142
|
* @returns {object[]} an array of objects representing market data
|
|
141
143
|
*/
|
|
142
|
-
const
|
|
144
|
+
const type = this.safeString(params, 'type', 'spot');
|
|
145
|
+
const request = this.omit(params, ['type']);
|
|
146
|
+
const response = await this.publicGetMarketStats(request);
|
|
143
147
|
const markets = this.safeDict(response, 'stats');
|
|
144
148
|
const marketKeys = Object.keys(markets);
|
|
145
149
|
const result = [];
|
|
@@ -148,13 +152,13 @@ class nobitex extends nobitex$1["default"] {
|
|
|
148
152
|
if (markets[symbol]['isClosed']) {
|
|
149
153
|
continue;
|
|
150
154
|
}
|
|
151
|
-
markets[symbol]
|
|
152
|
-
const market = this.parseMarket(
|
|
155
|
+
const data = this.extend(markets[symbol], { 'symbol': symbol });
|
|
156
|
+
const market = this.parseMarket(data, type);
|
|
153
157
|
result.push(market);
|
|
154
158
|
}
|
|
155
159
|
return result;
|
|
156
160
|
}
|
|
157
|
-
parseMarket(market) {
|
|
161
|
+
parseMarket(market, type = 'spot') {
|
|
158
162
|
// btc-rls: {
|
|
159
163
|
// isClosed: false,
|
|
160
164
|
// bestSell: "38820000000",
|
|
@@ -185,8 +189,8 @@ class nobitex extends nobitex$1["default"] {
|
|
|
185
189
|
'baseId': baseId,
|
|
186
190
|
'quoteId': quoteId,
|
|
187
191
|
'settleId': undefined,
|
|
188
|
-
'type':
|
|
189
|
-
'spot':
|
|
192
|
+
'type': type,
|
|
193
|
+
'spot': type === 'spot',
|
|
190
194
|
'margin': false,
|
|
191
195
|
'swap': false,
|
|
192
196
|
'future': false,
|
|
@@ -234,13 +238,16 @@ class nobitex extends nobitex$1["default"] {
|
|
|
234
238
|
* @see https://apidocs.nobitex.ir/#6ae2dae4a2
|
|
235
239
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
236
240
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
241
|
+
* @param {string} [params.type] market type, 'spot' (default) or 'otc'; both use market/stats
|
|
237
242
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
238
243
|
*/
|
|
239
|
-
|
|
244
|
+
const type = this.safeString(params, 'type', 'spot');
|
|
245
|
+
const request = this.omit(params, ['type']);
|
|
246
|
+
await this.loadMarkets(false, { 'type': type });
|
|
240
247
|
if (symbols !== undefined) {
|
|
241
248
|
symbols = this.marketSymbols(symbols);
|
|
242
249
|
}
|
|
243
|
-
const response = await this.publicGetMarketStats();
|
|
250
|
+
const response = await this.publicGetMarketStats(request);
|
|
244
251
|
const markets = this.safeDict(response, 'stats');
|
|
245
252
|
const marketKeys = Object.keys(markets);
|
|
246
253
|
const result = {};
|
|
@@ -249,8 +256,9 @@ class nobitex extends nobitex$1["default"] {
|
|
|
249
256
|
if (markets[symbol]['isClosed']) {
|
|
250
257
|
continue;
|
|
251
258
|
}
|
|
252
|
-
markets[symbol]
|
|
253
|
-
const
|
|
259
|
+
const data = this.extend(markets[symbol], { 'symbol': symbol });
|
|
260
|
+
const market = this.parseMarket(data, type);
|
|
261
|
+
const ticker = this.parseTicker(data, market);
|
|
254
262
|
symbol = ticker['symbol'];
|
|
255
263
|
result[symbol] = ticker;
|
|
256
264
|
}
|
|
@@ -264,10 +272,12 @@ class nobitex extends nobitex$1["default"] {
|
|
|
264
272
|
* @see https://apidocs.nobitex.ir/#6ae2dae4a2
|
|
265
273
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
266
274
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
275
|
+
* @param {string} [params.type] market type, 'spot' (default) or 'otc'; both use market/stats
|
|
267
276
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
268
277
|
*/
|
|
269
|
-
const
|
|
270
|
-
|
|
278
|
+
const tickers = await this.fetchTickers([symbol], params);
|
|
279
|
+
const values = Object.values(tickers);
|
|
280
|
+
return this.safeValue(values, 0);
|
|
271
281
|
}
|
|
272
282
|
parseTicker(ticker, market = undefined) {
|
|
273
283
|
// {
|
|
@@ -285,19 +295,8 @@ class nobitex extends nobitex$1["default"] {
|
|
|
285
295
|
// dayClose: "112800000000",
|
|
286
296
|
// dayChange: "0.01"
|
|
287
297
|
// }
|
|
288
|
-
|
|
289
|
-
const
|
|
290
|
-
const parts = rawSymbol.split('-');
|
|
291
|
-
const baseId = parts[0];
|
|
292
|
-
let quoteId = parts[1];
|
|
293
|
-
if (quoteId === 'rls') {
|
|
294
|
-
quoteId = 'irt';
|
|
295
|
-
}
|
|
296
|
-
const base = this.safeCurrencyCode(baseId.toUpperCase());
|
|
297
|
-
const quote = this.safeCurrencyCode(quoteId.toUpperCase());
|
|
298
|
-
const marketId = base + '/' + quote;
|
|
299
|
-
const marketinfo = this.market(marketId);
|
|
300
|
-
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
298
|
+
market = (market === undefined) ? this.parseMarket(ticker) : market;
|
|
299
|
+
const symbol = market['symbol'];
|
|
301
300
|
let high = this.safeFloat(ticker, 'dayHigh');
|
|
302
301
|
let low = this.safeFloat(ticker, 'dayLow');
|
|
303
302
|
let bid = this.safeFloat(ticker, 'bestBuy');
|
|
@@ -309,7 +308,7 @@ class nobitex extends nobitex$1["default"] {
|
|
|
309
308
|
let quoteVolume = this.safeFloat(ticker, 'volumeDst');
|
|
310
309
|
const baseVolume = this.safeFloat(ticker, 'volumeSrc');
|
|
311
310
|
// adjust Nobitex IRT scaling
|
|
312
|
-
if (
|
|
311
|
+
if (market['quote'] === 'IRT') {
|
|
313
312
|
high = high ? high / 10 : 0;
|
|
314
313
|
low = low ? low / 10 : 0;
|
|
315
314
|
bid = bid ? bid / 10 : 0;
|