ccxt-ir 4.23.2 → 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.
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var wallex$1 = require('./abstract/wallex.js');
6
+ var errors = require('./base/errors.js');
6
7
 
7
8
  // ----------------------------------------------------------------------------
8
9
  // ---------------------------------------------------------------------------
@@ -79,6 +80,7 @@ class wallex extends wallex$1["default"] {
79
80
  'fetchTradingFee': false,
80
81
  'fetchTradingFees': false,
81
82
  'fetchWithdrawals': false,
83
+ 'otc': true,
82
84
  'setLeverage': false,
83
85
  'setMarginMode': false,
84
86
  'transfer': false,
@@ -107,6 +109,8 @@ class wallex extends wallex$1["default"] {
107
109
  'public': {
108
110
  'get': {
109
111
  'v1/markets': 1,
112
+ 'v1/currencies': 1,
113
+ 'v1/otc/price': 1,
110
114
  'v1/currencies/stats': 1,
111
115
  'v1/depth': 1,
112
116
  'v1/udf/history': 1,
@@ -133,9 +137,39 @@ class wallex extends wallex$1["default"] {
133
137
  * @description retrieves data on all markets for wallex
134
138
  * @see https://api-docs.wallex.ir/#be8d9c51a2
135
139
  * @param {object} [params] extra parameters specific to the exchange API endpoint
140
+ * @param {string} [params.type] market type, 'spot' (default) or 'otc'
136
141
  * @returns {object[]} an array of objects representing market data
137
142
  */
138
- const response = await this.publicGetV1Markets(params);
143
+ const type = this.safeString(params, 'type', 'spot');
144
+ const request = this.omit(params, ['type']);
145
+ if (type === 'otc') {
146
+ const otcResponse = await this.publicGetV1Currencies(request);
147
+ const currencies = this.safeDict(otcResponse, 'result', {});
148
+ const baseIds = Object.keys(currencies);
149
+ const quoteIds = ['TMN', 'USDT'];
150
+ const otcMarkets = [];
151
+ for (let i = 0; i < baseIds.length; i++) {
152
+ const baseId = baseIds[i];
153
+ // TMN is a quote currency; the OTC API does not support TMNUSDT.
154
+ if (baseId === 'TMN') {
155
+ continue;
156
+ }
157
+ for (let j = 0; j < quoteIds.length; j++) {
158
+ const quoteId = quoteIds[j];
159
+ if (baseId === quoteId) {
160
+ continue;
161
+ }
162
+ otcMarkets.push(this.parseMarket({
163
+ 'symbol': baseId + quoteId,
164
+ 'baseAsset': baseId,
165
+ 'quoteAsset': quoteId,
166
+ 'info': currencies[baseId],
167
+ }, type));
168
+ }
169
+ }
170
+ return otcMarkets;
171
+ }
172
+ const response = await this.publicGetV1Markets(request);
139
173
  const markets = this.safeDict(response, 'result');
140
174
  const marketList = this.safeDict(markets, 'symbols');
141
175
  const marketKeys = Object.keys(marketList);
@@ -147,7 +181,7 @@ class wallex extends wallex$1["default"] {
147
181
  }
148
182
  return result;
149
183
  }
150
- parseMarket(market) {
184
+ parseMarket(market, type = 'spot') {
151
185
  // {
152
186
  // symbol: "PEPETMN",
153
187
  // baseAsset: "PEPE",
@@ -211,8 +245,8 @@ class wallex extends wallex$1["default"] {
211
245
  'baseId': baseId,
212
246
  'quoteId': quoteId,
213
247
  'settleId': undefined,
214
- 'type': 'spot',
215
- 'spot': true,
248
+ 'type': type,
249
+ 'spot': type === 'spot',
216
250
  'margin': false,
217
251
  'swap': false,
218
252
  'future': false,
@@ -249,7 +283,7 @@ class wallex extends wallex$1["default"] {
249
283
  },
250
284
  },
251
285
  'created': undefined,
252
- 'info': market,
286
+ 'info': this.safeDict(market, 'info', market),
253
287
  };
254
288
  }
255
289
  async fetchTickers(symbols = undefined, params = {}) {
@@ -260,8 +294,40 @@ class wallex extends wallex$1["default"] {
260
294
  * @see https://api-docs.wallex.ir/#be8d9c51a2
261
295
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
262
296
  * @param {object} [params] extra parameters specific to the exchange API endpoint
297
+ * @param {string} [params.type] market type, 'spot' (default) or 'otc'; OTC requests one BUY quote per symbol
263
298
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
264
299
  */
300
+ const type = this.safeString(params, 'type', 'spot');
301
+ params = this.omit(params, ['type']);
302
+ if (type === 'otc') {
303
+ let otcMarkets = await this.fetchMarkets(this.extend(params, { 'type': type }));
304
+ if (symbols !== undefined) {
305
+ const marketsBySymbol = this.indexBy(otcMarkets, 'symbol');
306
+ const marketsById = this.indexBy(otcMarkets, 'id');
307
+ const selectedMarkets = [];
308
+ for (let i = 0; i < symbols.length; i++) {
309
+ const symbol = symbols[i];
310
+ const market = this.safeDict(marketsBySymbol, symbol, this.safeDict(marketsById, symbol));
311
+ if (market === undefined) {
312
+ throw new errors.BadSymbol(this.id + ' does not have OTC market symbol ' + symbol);
313
+ }
314
+ selectedMarkets.push(market);
315
+ }
316
+ otcMarkets = selectedMarkets;
317
+ }
318
+ const otcTickers = {};
319
+ for (let i = 0; i < otcMarkets.length; i++) {
320
+ const market = otcMarkets[i];
321
+ const request = this.extend(params, { 'side': 'BUY', 'symbol': market['id'] });
322
+ const otcResponse = await this.publicGetV1OtcPrice(request);
323
+ const data = this.safeDict(otcResponse, 'result', {});
324
+ if (this.safeString(data, 'price') === undefined) {
325
+ throw new errors.ExchangeError(this.id + ' OTC quote unavailable for ' + market['symbol'] + ': ' + this.json(otcResponse));
326
+ }
327
+ otcTickers[market['symbol']] = this.parseTicker(data, market);
328
+ }
329
+ return otcTickers;
330
+ }
265
331
  await this.loadMarkets();
266
332
  if (symbols !== undefined) {
267
333
  symbols = this.marketSymbols(symbols);
@@ -273,7 +339,8 @@ class wallex extends wallex$1["default"] {
273
339
  const result = {};
274
340
  for (let i = 0; i < marketKeys.length; i++) {
275
341
  const index = marketKeys[i];
276
- const ticker = this.parseTicker(marketList[index]);
342
+ const market = this.parseMarket(marketList[index]);
343
+ const ticker = this.parseTicker(marketList[index], market);
277
344
  const symbol = ticker['symbol'];
278
345
  result[symbol] = ticker;
279
346
  }
@@ -287,15 +354,12 @@ class wallex extends wallex$1["default"] {
287
354
  * @see https://api-docs.wallex.ir/#be8d9c51a2
288
355
  * @param {string} symbol unified symbol of the market to fetch the ticker for
289
356
  * @param {object} [params] extra parameters specific to the exchange API endpoint
357
+ * @param {string} [params.type] market type, 'spot' (default) or 'otc'
290
358
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
291
359
  */
292
- await this.loadMarkets();
293
- const market = this.market(symbol);
294
- const response = await this.publicGetV1Markets(params);
295
- const markets = this.safeDict(response, 'result');
296
- const marketList = this.safeDict(markets, 'symbols');
297
- const ticker = this.parseTicker(marketList[market['id']]);
298
- return ticker;
360
+ const tickers = await this.fetchTickers([symbol], params);
361
+ const values = Object.values(tickers);
362
+ return this.safeValue(values, 0);
299
363
  }
300
364
  parseTicker(ticker, market = undefined) {
301
365
  // {
@@ -345,7 +409,33 @@ class wallex extends wallex$1["default"] {
345
409
  // isNew: false,
346
410
  // isZeroFee: false
347
411
  // },
348
- const marketType = 'spot';
412
+ const marketType = this.safeString(market, 'type', 'spot');
413
+ if (marketType === 'otc') {
414
+ const timestamp = this.parse8601(this.safeString(ticker, 'current_time'));
415
+ const price = this.safeNumber(ticker, 'price');
416
+ return this.safeTicker({
417
+ 'symbol': market['symbol'],
418
+ 'timestamp': timestamp,
419
+ 'datetime': this.iso8601(timestamp),
420
+ 'high': undefined,
421
+ 'low': undefined,
422
+ 'bid': undefined,
423
+ 'bidVolume': undefined,
424
+ 'ask': price,
425
+ 'askVolume': undefined,
426
+ 'vwap': undefined,
427
+ 'open': undefined,
428
+ 'close': price,
429
+ 'last': price,
430
+ 'previousClose': undefined,
431
+ 'change': undefined,
432
+ 'percentage': undefined,
433
+ 'average': undefined,
434
+ 'baseVolume': undefined,
435
+ 'quoteVolume': undefined,
436
+ 'info': ticker,
437
+ }, market);
438
+ }
349
439
  const stats = this.safeValue(ticker, 'stats');
350
440
  const marketId = this.safeString(ticker, 'symbol');
351
441
  const symbol = this.safeSymbol(marketId, market, undefined, marketType);
@@ -454,10 +544,7 @@ class wallex extends wallex$1["default"] {
454
544
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
455
545
  const query = this.omit(params, this.extractParams(path));
456
546
  let url = this.urls['api']['public'] + '/' + path;
457
- if (path === 'v1/udf/history') {
458
- url = url + '?' + this.urlencode(query);
459
- }
460
- if (path === 'v1/depth') {
547
+ if (!this.isEmpty(query)) {
461
548
  url = url + '?' + this.urlencode(query);
462
549
  }
463
550
  headers = { 'Content-Type': 'application/json' };
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketMarginModes, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, LongShortRatio, OrderBooks, OpenInterests, ConstructorArgs } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
7
- declare const version = "4.23.2";
7
+ declare const version = "4.24.1";
8
8
  import abantether from './src/abantether.js';
9
9
  import afratether from './src/afratether.js';
10
10
  import alpaca from './src/alpaca.js';
@@ -16,6 +16,7 @@ import asacoine from './src/asacoine.js';
16
16
  import ascendex from './src/ascendex.js';
17
17
  import asretether from './src/asretether.js';
18
18
  import baazar from './src/baazar.js';
19
+ import balinex from './src/balinex.js';
19
20
  import bequant from './src/bequant.js';
20
21
  import bidarz from './src/bidarz.js';
21
22
  import bigone from './src/bigone.js';
@@ -266,6 +267,7 @@ declare const exchanges: {
266
267
  ascendex: typeof ascendex;
267
268
  asretether: typeof asretether;
268
269
  baazar: typeof baazar;
270
+ balinex: typeof balinex;
269
271
  bequant: typeof bequant;
270
272
  bidarz: typeof bidarz;
271
273
  bigone: typeof bigone;
@@ -599,6 +601,7 @@ declare const ccxt: {
599
601
  ascendex: typeof ascendex;
600
602
  asretether: typeof asretether;
601
603
  baazar: typeof baazar;
604
+ balinex: typeof balinex;
602
605
  bequant: typeof bequant;
603
606
  bidarz: typeof bidarz;
604
607
  bigone: typeof bigone;
@@ -765,5 +768,5 @@ declare const ccxt: {
765
768
  zarpin: typeof zarpin;
766
769
  zonda: typeof zonda;
767
770
  } & typeof functions & typeof errors;
768
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError, Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, ConstructorArgs, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketMarginModes, MarketInterface, Trade, Order, OrderBook, OrderBooks, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, OpenInterests, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, LongShortRatio, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, abantether, afratether, alpaca, apex, ariomex, arzinja, arzplus, asacoine, ascendex, asretether, baazar, bequant, bidarz, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit24, bit2c, bitbank, bitbarg, bitbns, bitfinex, bitflyer, bitget, bithumb, bitimen, bitir, bitmart, bitmex, bitopro, bitpin, bitrue, bitso, bitstamp, bitteam, bittrade, bitunix, bitvavo, bitwana, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, bydfi, cafearz, cex, changefa, coinbase, coinbaseadvanced, coinbaseexchange, coinbaseinternational, coincatch, coincheck, coinex, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, cryptomus, daric, defx, delta, deribit, derive, digifinex, digikalagold, ellipx, eterex, excoino, exino, exir, exmo, exnovin, farhadexchange, fmfwio, foxbit, gate, gateio, gemini, gerami, goldika, goldis, hamrahgold, hamtapay, hashkey, hibachi, hitbtc, hitobit, hollaex, htx, huobi, hyperliquid, independentreserve, indodax, iranexchange, jibitex, kcex, kifpoolme, kraken, krakenfutures, kucoin, kucoinfutures, latoken, lbank, luno, mazdax, melligold, mercado, mexc, milligold, modetrade, myokx, ndax, nobitex, novadax, oceanex, okcoin, okexchange, okx, okxus, ompfinex, onetrading, ourbit, oxfun, p2b, paradex, paymium, phemex, pingi, poloniex, pooleno, poulyar, probit, raastin, ramzinex, saraf, sarmayex, sarrafex, swapwallet, tabdeal, talaavan, talapp, talasea, technogold, tehran_exchange, tetherland, timex, tokocrypto, toobit, tradeogre, twox, ubitex, upbit, vertex, wallex, wallgold, wavesexchange, whitebit, woo, woofipro, xt, yobit, zaif, zarafza, zarminex, zarniv, zarpin, zonda, };
771
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError, Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, ConstructorArgs, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketMarginModes, MarketInterface, Trade, Order, OrderBook, OrderBooks, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, OpenInterests, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, LongShortRatio, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, abantether, afratether, alpaca, apex, ariomex, arzinja, arzplus, asacoine, ascendex, asretether, baazar, balinex, bequant, bidarz, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit24, bit2c, bitbank, bitbarg, bitbns, bitfinex, bitflyer, bitget, bithumb, bitimen, bitir, bitmart, bitmex, bitopro, bitpin, bitrue, bitso, bitstamp, bitteam, bittrade, bitunix, bitvavo, bitwana, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, bydfi, cafearz, cex, changefa, coinbase, coinbaseadvanced, coinbaseexchange, coinbaseinternational, coincatch, coincheck, coinex, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, cryptomus, daric, defx, delta, deribit, derive, digifinex, digikalagold, ellipx, eterex, excoino, exino, exir, exmo, exnovin, farhadexchange, fmfwio, foxbit, gate, gateio, gemini, gerami, goldika, goldis, hamrahgold, hamtapay, hashkey, hibachi, hitbtc, hitobit, hollaex, htx, huobi, hyperliquid, independentreserve, indodax, iranexchange, jibitex, kcex, kifpoolme, kraken, krakenfutures, kucoin, kucoinfutures, latoken, lbank, luno, mazdax, melligold, mercado, mexc, milligold, modetrade, myokx, ndax, nobitex, novadax, oceanex, okcoin, okexchange, okx, okxus, ompfinex, onetrading, ourbit, oxfun, p2b, paradex, paymium, phemex, pingi, poloniex, pooleno, poulyar, probit, raastin, ramzinex, saraf, sarmayex, sarrafex, swapwallet, tabdeal, talaavan, talapp, talasea, technogold, tehran_exchange, tetherland, timex, tokocrypto, toobit, tradeogre, twox, ubitex, upbit, vertex, wallex, wallgold, wavesexchange, whitebit, woo, woofipro, xt, yobit, zaif, zarafza, zarminex, zarniv, zarpin, zonda, };
769
772
  export default ccxt;
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.23.2';
41
+ const version = '4.24.1';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import abantether from './src/abantether.js';
@@ -52,6 +52,7 @@ import asacoine from './src/asacoine.js';
52
52
  import ascendex from './src/ascendex.js';
53
53
  import asretether from './src/asretether.js';
54
54
  import baazar from './src/baazar.js';
55
+ import balinex from './src/balinex.js';
55
56
  import bequant from './src/bequant.js';
56
57
  import bidarz from './src/bidarz.js';
57
58
  import bigone from './src/bigone.js';
@@ -303,6 +304,7 @@ const exchanges = {
303
304
  'ascendex': ascendex,
304
305
  'asretether': asretether,
305
306
  'baazar': baazar,
307
+ 'balinex': balinex,
306
308
  'bequant': bequant,
307
309
  'bidarz': bidarz,
308
310
  'bigone': bigone,
@@ -556,6 +558,6 @@ pro.exchanges = Object.keys(pro);
556
558
  pro['Exchange'] = Exchange; // now the same for rest and ts
557
559
  //-----------------------------------------------------------------------------
558
560
  const ccxt = Object.assign({ version, Exchange, Precise, 'exchanges': Object.keys(exchanges), 'pro': pro }, exchanges, functions, errors);
559
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError, abantether, afratether, alpaca, apex, ariomex, arzinja, arzplus, asacoine, ascendex, asretether, baazar, bequant, bidarz, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit24, bit2c, bitbank, bitbarg, bitbns, bitfinex, bitflyer, bitget, bithumb, bitimen, bitir, bitmart, bitmex, bitopro, bitpin, bitrue, bitso, bitstamp, bitteam, bittrade, bitunix, bitvavo, bitwana, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, bydfi, cafearz, cex, changefa, coinbase, coinbaseadvanced, coinbaseexchange, coinbaseinternational, coincatch, coincheck, coinex, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, cryptomus, daric, defx, delta, deribit, derive, digifinex, digikalagold, ellipx, eterex, excoino, exino, exir, exmo, exnovin, farhadexchange, fmfwio, foxbit, gate, gateio, gemini, gerami, goldika, goldis, hamrahgold, hamtapay, hashkey, hibachi, hitbtc, hitobit, hollaex, htx, huobi, hyperliquid, independentreserve, indodax, iranexchange, jibitex, kcex, kifpoolme, kraken, krakenfutures, kucoin, kucoinfutures, latoken, lbank, luno, mazdax, melligold, mercado, mexc, milligold, modetrade, myokx, ndax, nobitex, novadax, oceanex, okcoin, okexchange, okx, okxus, ompfinex, onetrading, ourbit, oxfun, p2b, paradex, paymium, phemex, pingi, poloniex, pooleno, poulyar, probit, raastin, ramzinex, saraf, sarmayex, sarrafex, swapwallet, tabdeal, talaavan, talapp, talasea, technogold, tehran_exchange, tetherland, timex, tokocrypto, toobit, tradeogre, twox, ubitex, upbit, vertex, wallex, wallgold, wavesexchange, whitebit, woo, woofipro, xt, yobit, zaif, zarafza, zarminex, zarniv, zarpin, zonda, };
561
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError, abantether, afratether, alpaca, apex, ariomex, arzinja, arzplus, asacoine, ascendex, asretether, baazar, balinex, bequant, bidarz, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit24, bit2c, bitbank, bitbarg, bitbns, bitfinex, bitflyer, bitget, bithumb, bitimen, bitir, bitmart, bitmex, bitopro, bitpin, bitrue, bitso, bitstamp, bitteam, bittrade, bitunix, bitvavo, bitwana, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, bydfi, cafearz, cex, changefa, coinbase, coinbaseadvanced, coinbaseexchange, coinbaseinternational, coincatch, coincheck, coinex, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, cryptomus, daric, defx, delta, deribit, derive, digifinex, digikalagold, ellipx, eterex, excoino, exino, exir, exmo, exnovin, farhadexchange, fmfwio, foxbit, gate, gateio, gemini, gerami, goldika, goldis, hamrahgold, hamtapay, hashkey, hibachi, hitbtc, hitobit, hollaex, htx, huobi, hyperliquid, independentreserve, indodax, iranexchange, jibitex, kcex, kifpoolme, kraken, krakenfutures, kucoin, kucoinfutures, latoken, lbank, luno, mazdax, melligold, mercado, mexc, milligold, modetrade, myokx, ndax, nobitex, novadax, oceanex, okcoin, okexchange, okx, okxus, ompfinex, onetrading, ourbit, oxfun, p2b, paradex, paymium, phemex, pingi, poloniex, pooleno, poulyar, probit, raastin, ramzinex, saraf, sarmayex, sarrafex, swapwallet, tabdeal, talaavan, talapp, talasea, technogold, tehran_exchange, tetherland, timex, tokocrypto, toobit, tradeogre, twox, ubitex, upbit, vertex, wallex, wallgold, wavesexchange, whitebit, woo, woofipro, xt, yobit, zaif, zarafza, zarminex, zarniv, zarpin, zonda, };
560
562
  export default ccxt;
561
563
  //-----------------------------------------------------------------------------
@@ -0,0 +1,8 @@
1
+ import { implicitReturnType } from '../base/types.js';
2
+ import { Exchange as _Exchange } from '../base/Exchange.js';
3
+ interface Exchange {
4
+ publicGetPublicMarkets(params?: {}): Promise<implicitReturnType>;
5
+ }
6
+ declare abstract class Exchange extends _Exchange {
7
+ }
8
+ export default Exchange;
@@ -0,0 +1,11 @@
1
+ // ----------------------------------------------------------------------------
2
+
3
+ // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
7
+ // -------------------------------------------------------------------------------
8
+ import { Exchange as _Exchange } from '../base/Exchange.js';
9
+ class Exchange extends _Exchange {
10
+ }
11
+ export default Exchange;
@@ -2,6 +2,8 @@ import { implicitReturnType } from '../base/types.js';
2
2
  import { Exchange as _Exchange } from '../base/Exchange.js';
3
3
  interface Exchange {
4
4
  publicGetV1Markets(params?: {}): Promise<implicitReturnType>;
5
+ publicGetV1Currencies(params?: {}): Promise<implicitReturnType>;
6
+ publicGetV1OtcPrice(params?: {}): Promise<implicitReturnType>;
5
7
  publicGetV1CurrenciesStats(params?: {}): Promise<implicitReturnType>;
6
8
  publicGetV1Depth(params?: {}): Promise<implicitReturnType>;
7
9
  publicGetV1UdfHistory(params?: {}): Promise<implicitReturnType>;
@@ -0,0 +1,20 @@
1
+ import Exchange from './abstract/balinex.js';
2
+ import { Market, Strings, Ticker, Tickers } from './base/types.js';
3
+ /**
4
+ * @class balinex
5
+ * @augments Exchange
6
+ */
7
+ export default class balinex extends Exchange {
8
+ describe(): any;
9
+ fetchMarkets(params?: {}): Promise<Market[]>;
10
+ parseMarket(market: any): Market;
11
+ fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
12
+ fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
13
+ parseTicker(ticker: any, market?: Market): Ticker;
14
+ sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
15
+ url: string;
16
+ method: string;
17
+ body: any;
18
+ headers: any;
19
+ };
20
+ }
@@ -0,0 +1,226 @@
1
+ // ----------------------------------------------------------------------------
2
+
3
+ // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
7
+ // ---------------------------------------------------------------------------
8
+ import Exchange from './abstract/balinex.js';
9
+ // ---------------------------------------------------------------------------
10
+ /**
11
+ * @class balinex
12
+ * @augments Exchange
13
+ */
14
+ export default class balinex extends Exchange {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'balinex',
18
+ 'name': 'Balinex',
19
+ 'countries': ['IR'],
20
+ 'rateLimit': 1000,
21
+ 'version': '1',
22
+ 'certified': false,
23
+ 'pro': false,
24
+ 'has': {
25
+ 'CORS': undefined,
26
+ 'spot': true,
27
+ 'margin': false,
28
+ 'swap': false,
29
+ 'future': false,
30
+ 'option': false,
31
+ 'fetchMarkets': true,
32
+ 'fetchTicker': true,
33
+ 'fetchTickers': true,
34
+ },
35
+ 'urls': {
36
+ 'logo': 'https://balinex.com/favicon.ico',
37
+ 'api': {
38
+ 'public': 'https://api.balinex.com',
39
+ },
40
+ 'www': 'https://balinex.com',
41
+ 'doc': [
42
+ 'https://api.balinex.com/public/markets',
43
+ ],
44
+ },
45
+ 'api': {
46
+ 'public': {
47
+ 'get': {
48
+ 'public/markets': 1,
49
+ },
50
+ },
51
+ },
52
+ });
53
+ }
54
+ async fetchMarkets(params = {}) {
55
+ /**
56
+ * @method
57
+ * @name balinex#fetchMarkets
58
+ * @description retrieves data on all markets for balinex
59
+ * @see https://api.balinex.com/public/markets
60
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
61
+ * @returns {object[]} an array of objects representing market data
62
+ */
63
+ const response = await this.publicGetPublicMarkets(params);
64
+ const data = this.safeDict(response, 'result', {});
65
+ const items = this.safeList(data, 'items', []);
66
+ const result = [];
67
+ for (let i = 0; i < items.length; i++) {
68
+ result.push(this.parseMarket(items[i]));
69
+ }
70
+ return result;
71
+ }
72
+ parseMarket(market) {
73
+ // {
74
+ // "productId": "ADAUSDT",
75
+ // "baseCurrency": "ADA",
76
+ // "quoteCurrency": "USDT",
77
+ // "baseScale": 2,
78
+ // "quoteScale": 4,
79
+ // "lastPrice": "0.2047",
80
+ // "openPrice24h": "0.2089",
81
+ // "highPrice24h": "0.2103",
82
+ // "lowPrice24h": "0.2012",
83
+ // "volume24h": "1530110.38",
84
+ // "quoteVolume24h": "313213.5968",
85
+ // "priceChange24h": "-0.0042",
86
+ // "percentChange24h": "-2.01",
87
+ // "allowBuy": true,
88
+ // "allowSell": true
89
+ // }
90
+ const id = this.safeString(market, 'productId');
91
+ const baseId = this.safeString(market, 'baseCurrency');
92
+ const quoteId = this.safeString(market, 'quoteCurrency');
93
+ const base = this.safeCurrencyCode(baseId);
94
+ const quote = this.safeCurrencyCode(quoteId);
95
+ const allowBuy = this.safeBool(market, 'allowBuy', false);
96
+ const allowSell = this.safeBool(market, 'allowSell', false);
97
+ return {
98
+ 'id': id,
99
+ 'symbol': base + '/' + quote,
100
+ 'base': base,
101
+ 'quote': quote,
102
+ 'settle': undefined,
103
+ 'baseId': baseId,
104
+ 'quoteId': quoteId,
105
+ 'settleId': undefined,
106
+ 'type': 'spot',
107
+ 'spot': true,
108
+ 'margin': false,
109
+ 'swap': false,
110
+ 'future': false,
111
+ 'option': false,
112
+ 'active': allowBuy && allowSell,
113
+ 'contract': false,
114
+ 'linear': undefined,
115
+ 'inverse': undefined,
116
+ 'contractSize': undefined,
117
+ 'expiry': undefined,
118
+ 'expiryDatetime': undefined,
119
+ 'strike': undefined,
120
+ 'optionType': undefined,
121
+ 'precision': {
122
+ 'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'baseScale'))),
123
+ 'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'quoteScale'))),
124
+ },
125
+ 'limits': {
126
+ 'leverage': { 'min': undefined, 'max': undefined },
127
+ 'amount': { 'min': undefined, 'max': undefined },
128
+ 'price': { 'min': undefined, 'max': undefined },
129
+ 'cost': { 'min': undefined, 'max': undefined },
130
+ },
131
+ 'created': undefined,
132
+ 'info': market,
133
+ };
134
+ }
135
+ async fetchTickers(symbols = undefined, params = {}) {
136
+ /**
137
+ * @method
138
+ * @name balinex#fetchTickers
139
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
140
+ * @see https://api.balinex.com/public/markets
141
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
142
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
143
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
144
+ */
145
+ await this.loadMarkets();
146
+ if (symbols !== undefined) {
147
+ symbols = this.marketSymbols(symbols);
148
+ }
149
+ const response = await this.publicGetPublicMarkets(params);
150
+ const data = this.safeDict(response, 'result', {});
151
+ const items = this.safeList(data, 'items', []);
152
+ const result = {};
153
+ for (let i = 0; i < items.length; i++) {
154
+ const ticker = this.parseTicker(items[i]);
155
+ const symbol = ticker['symbol'];
156
+ result[symbol] = ticker;
157
+ }
158
+ return this.filterByArrayTickers(result, 'symbol', symbols);
159
+ }
160
+ async fetchTicker(symbol, params = {}) {
161
+ /**
162
+ * @method
163
+ * @name balinex#fetchTicker
164
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
165
+ * @see https://api.balinex.com/public/markets
166
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
167
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
168
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
169
+ */
170
+ const ticker = await this.fetchTickers([symbol], params);
171
+ return ticker[symbol];
172
+ }
173
+ parseTicker(ticker, market = undefined) {
174
+ // {
175
+ // "productId": "BTCIRT",
176
+ // "baseCurrency": "BTC",
177
+ // "quoteCurrency": "IRT",
178
+ // "baseScale": 7,
179
+ // "quoteScale": 0,
180
+ // "lastPrice": "21703802224",
181
+ // "openPrice24h": "21816018777",
182
+ // "highPrice24h": "21823312074",
183
+ // "lowPrice24h": "21341032776",
184
+ // "volume24h": "1.4538258",
185
+ // "quoteVolume24h": "31553547631",
186
+ // "priceChange24h": "-112216553",
187
+ // "percentChange24h": "-0.51",
188
+ // "allowBuy": true,
189
+ // "allowSell": true
190
+ // }
191
+ const marketId = this.safeString(ticker, 'productId');
192
+ market = this.safeMarket(marketId, market);
193
+ const last = this.safeString(ticker, 'lastPrice');
194
+ return this.safeTicker({
195
+ 'symbol': market['symbol'],
196
+ 'timestamp': undefined,
197
+ 'datetime': undefined,
198
+ 'high': this.safeString(ticker, 'highPrice24h'),
199
+ 'low': this.safeString(ticker, 'lowPrice24h'),
200
+ 'bid': undefined,
201
+ 'bidVolume': undefined,
202
+ 'ask': undefined,
203
+ 'askVolume': undefined,
204
+ 'vwap': undefined,
205
+ 'open': this.safeString(ticker, 'openPrice24h'),
206
+ 'close': last,
207
+ 'last': last,
208
+ 'previousClose': undefined,
209
+ 'change': this.safeString(ticker, 'priceChange24h'),
210
+ 'percentage': this.safeString(ticker, 'percentChange24h'),
211
+ 'average': undefined,
212
+ 'baseVolume': this.safeString(ticker, 'volume24h'),
213
+ 'quoteVolume': this.safeString(ticker, 'quoteVolume24h'),
214
+ 'info': ticker,
215
+ }, market);
216
+ }
217
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
218
+ let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
219
+ const query = this.omit(params, this.extractParams(path));
220
+ if (Object.keys(query).length) {
221
+ url += '?' + this.urlencode(query);
222
+ }
223
+ headers = { 'Accept': 'application/json' };
224
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
225
+ }
226
+ }
@@ -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;