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.
Files changed (40) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +262 -262
  4. package/dist/cjs/package.json +1 -1
  5. package/dist/cjs/src/abstract/balinex.js +1 -1
  6. package/dist/cjs/src/balinex.js +217 -217
  7. package/dist/cjs/src/bitbarg.js +322 -322
  8. package/dist/cjs/src/bitpin.js +34 -24
  9. package/dist/cjs/src/nobitex.js +25 -26
  10. package/dist/cjs/src/swapwallet.js +209 -209
  11. package/dist/cjs/src/wallex.js +105 -18
  12. package/js/ccxt.d.ts +772 -772
  13. package/js/ccxt.js +557 -557
  14. package/js/src/abstract/balinex.d.ts +8 -8
  15. package/js/src/abstract/balinex.js +5 -5
  16. package/js/src/abstract/swapwallet.js +5 -5
  17. package/js/src/abstract/wallex.d.ts +2 -0
  18. package/js/src/balinex.d.ts +20 -20
  19. package/js/src/balinex.js +220 -220
  20. package/js/src/base/Exchange.d.ts +926 -926
  21. package/js/src/bitbarg.js +325 -325
  22. package/js/src/bitpin.d.ts +2 -2
  23. package/js/src/bitpin.js +34 -24
  24. package/js/src/coinbaseexchange.d.ts +334 -334
  25. package/js/src/nobitex.d.ts +2 -2
  26. package/js/src/nobitex.js +25 -26
  27. package/js/src/protobuf/mexc/compiled.d.cts +2 -8
  28. package/js/src/static_dependencies/fflake/browser.d.ts +222 -222
  29. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
  30. package/js/src/static_dependencies/qs/formats.d.cts +8 -14
  31. package/js/src/static_dependencies/qs/index.d.cts +4 -10
  32. package/js/src/static_dependencies/qs/parse.d.cts +2 -8
  33. package/js/src/static_dependencies/qs/stringify.d.cts +2 -8
  34. package/js/src/static_dependencies/qs/utils.d.cts +9 -15
  35. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
  36. package/js/src/swapwallet.js +212 -212
  37. package/js/src/wallex.d.ts +2 -2
  38. package/js/src/wallex.js +105 -18
  39. package/js/test.js +51 -62
  40. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bitpin.js';
2
- import { Int, Market, OHLCV, OrderBook, Strings, Ticker, Tickers } from './base/types.js';
2
+ import { Int, Market, MarketType, OHLCV, OrderBook, Strings, Ticker, Tickers } from './base/types.js';
3
3
  /**
4
4
  * @class bitpin
5
5
  * @augments Exchange
@@ -8,7 +8,7 @@ import { Int, Market, OHLCV, OrderBook, Strings, Ticker, Tickers } from './base/
8
8
  export default class bitpin extends Exchange {
9
9
  describe(): any;
10
10
  fetchMarkets(params?: {}): Promise<Market[]>;
11
- parseMarket(market: any): Market;
11
+ parseMarket(market: any, type?: MarketType): Market;
12
12
  fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
13
13
  fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
14
14
  parseTicker(ticker: any, market?: Market): Ticker;
package/js/src/bitpin.js CHANGED
@@ -80,6 +80,7 @@ export default class bitpin extends Exchange {
80
80
  'fetchTradingFee': false,
81
81
  'fetchTradingFees': false,
82
82
  'fetchWithdrawals': false,
83
+ 'otc': true,
83
84
  'setLeverage': false,
84
85
  'setMarginMode': false,
85
86
  'transfer': false,
@@ -136,18 +137,23 @@ export default class bitpin extends Exchange {
136
137
  * @description retrieves data on all markets for bitpin
137
138
  * @see https://api-docs.bitpin.ir/#be8d9c51a2
138
139
  * @param {object} [params] extra parameters specific to the exchange API endpoint
140
+ * @param {string} [params.type] market type, 'spot' (default) or 'otc'
139
141
  * @returns {object[]} an array of objects representing market data
140
142
  */
141
- const response = await this.publicGetV1MktMarkets(params);
143
+ const type = this.safeString(params, 'type', 'spot');
144
+ const request = this.omit(params, ['type']);
145
+ const response = await this.publicGetV1MktMarkets(request);
142
146
  const markets = this.safeList(response, 'results');
147
+ const tradableKey = (type === 'otc') ? 'otc_tradable' : 'tradable';
143
148
  const result = [];
144
149
  for (let i = 0; i < markets.length; i++) {
145
- const market = this.parseMarket(markets[i]);
146
- result.push(market);
150
+ if (this.safeBool(markets[i], tradableKey, false)) {
151
+ result.push(this.parseMarket(markets[i], type));
152
+ }
147
153
  }
148
154
  return result;
149
155
  }
150
- parseMarket(market) {
156
+ parseMarket(market, type = 'spot') {
151
157
  const id = this.safeString(market, 'id');
152
158
  const baseCurrency = this.safeDict(market, 'currency1');
153
159
  const quoteCurrency = this.safeDict(market, 'currency2');
@@ -157,6 +163,7 @@ export default class bitpin extends Exchange {
157
163
  const quote = this.safeCurrencyCode(quoteId);
158
164
  baseId = baseId.toLowerCase();
159
165
  quoteId = quoteId.toLowerCase();
166
+ const tradableKey = (type === 'otc') ? 'otc_tradable' : 'tradable';
160
167
  return {
161
168
  'id': id,
162
169
  'symbol': base + '/' + quote,
@@ -166,13 +173,13 @@ export default class bitpin extends Exchange {
166
173
  'baseId': baseId,
167
174
  'quoteId': quoteId,
168
175
  'settleId': undefined,
169
- 'type': 'spot',
170
- 'spot': true,
176
+ 'type': type,
177
+ 'spot': type === 'spot',
171
178
  'margin': false,
172
179
  'swap': false,
173
180
  'future': false,
174
181
  'option': false,
175
- 'active': true,
182
+ 'active': this.safeBool(market, tradableKey, false),
176
183
  'contract': false,
177
184
  'linear': undefined,
178
185
  'inverse': undefined,
@@ -215,19 +222,20 @@ export default class bitpin extends Exchange {
215
222
  * @see https://api-docs.bitpin.ir/#be8d9c51a2
216
223
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
217
224
  * @param {object} [params] extra parameters specific to the exchange API endpoint
225
+ * @param {string} [params.type] market type, 'spot' (default) or 'otc'
218
226
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
219
227
  */
220
- await this.loadMarkets();
221
- if (symbols !== undefined) {
222
- symbols = this.marketSymbols(symbols);
223
- }
224
- const response = await this.publicGetV1MktMarkets(params);
228
+ const type = this.safeString(params, 'type', 'spot');
229
+ const request = this.omit(params, ['type']);
230
+ await this.loadMarkets(false, { 'type': type });
231
+ const response = await this.publicGetV1MktMarkets(request);
225
232
  const markets = this.safeList(response, 'results');
233
+ const tradableKey = (type === 'otc') ? 'otc_tradable' : 'tradable';
226
234
  const result = {};
227
235
  for (let i = 0; i < markets.length; i++) {
228
- const is_active = this.safeBool(markets[i], 'tradable');
229
- if (is_active === true) {
230
- const ticker = this.parseTicker(markets[i]);
236
+ if (this.safeBool(markets[i], tradableKey, false)) {
237
+ const market = this.parseMarket(markets[i], type);
238
+ const ticker = this.parseTicker(markets[i], market);
231
239
  const symbol = ticker['symbol'];
232
240
  result[symbol] = ticker;
233
241
  }
@@ -242,9 +250,10 @@ export default class bitpin extends Exchange {
242
250
  * @see https://api-docs.bitpin.ir/#be8d9c51a2
243
251
  * @param {string} symbol unified symbol of the market to fetch the ticker for
244
252
  * @param {object} [params] extra parameters specific to the exchange API endpoint
253
+ * @param {string} [params.type] market type, 'spot' (default) or 'otc'
245
254
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
246
255
  */
247
- const ticker = await this.fetchTickers([symbol]);
256
+ const ticker = await this.fetchTickers([symbol], params);
248
257
  return ticker[symbol];
249
258
  }
250
259
  parseTicker(ticker, market = undefined) {
@@ -361,16 +370,17 @@ export default class bitpin extends Exchange {
361
370
  // 'popularity_weight': 0,
362
371
  // 'freshness_weight': 0,
363
372
  // }
364
- const marketType = 'spot';
365
- const priceInfo = this.safeValue(ticker, 'order_book_info');
373
+ const marketType = this.safeString(market, 'type', 'spot');
374
+ const priceInfoKey = (marketType === 'otc') ? 'price_info' : 'order_book_info';
375
+ const priceInfo = this.safeDict(ticker, priceInfoKey, {});
366
376
  const marketId = this.safeString(ticker, 'id');
367
377
  const symbol = this.safeSymbol(marketId, market, undefined, marketType);
368
- const high = this.safeFloat(priceInfo, 'max', 0);
369
- const low = this.safeFloat(priceInfo, 'min', 0);
370
- const last = this.safeFloat(priceInfo, 'price', 0);
371
- const change = this.safeFloat(priceInfo, 'change', 0);
372
- const baseVolume = this.safeFloat(priceInfo, 'amount', 0);
373
- const quoteVolume = this.safeFloat(priceInfo, 'value', 0);
378
+ const high = this.safeFloat(priceInfo, 'max');
379
+ const low = this.safeFloat(priceInfo, 'min');
380
+ const last = this.safeFloat(priceInfo, 'price');
381
+ const change = this.safeFloat(priceInfo, 'change');
382
+ const baseVolume = this.safeFloat(priceInfo, 'amount');
383
+ const quoteVolume = this.safeFloat(priceInfo, 'value');
374
384
  return this.safeTicker({
375
385
  'symbol': symbol,
376
386
  'timestamp': undefined,