ccxt-ir 4.9.27 → 4.9.29

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.
@@ -5,386 +5,386 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var bit24$1 = require('./abstract/bit24.js');
6
6
 
7
7
  // ----------------------------------------------------------------------------
8
- // ---------------------------------------------------------------------------
9
- /**
10
- * @class bit24
11
- * @augments Exchange
12
- * @description Set rateLimit to 1000 if fully verified
13
- */
14
- class bit24 extends bit24$1["default"] {
15
- describe() {
16
- return this.deepExtend(super.describe(), {
17
- 'id': 'bit24',
18
- 'name': 'Bit24',
19
- 'countries': ['IR'],
20
- 'rateLimit': 1000,
21
- 'version': '1',
22
- 'certified': false,
23
- 'pro': false,
24
- 'has': {
25
- 'CORS': undefined,
26
- 'spot': false,
27
- 'otc': true,
28
- 'margin': false,
29
- 'swap': false,
30
- 'future': false,
31
- 'option': false,
32
- 'addMargin': false,
33
- 'cancelAllOrders': false,
34
- 'cancelOrder': false,
35
- 'cancelOrders': false,
36
- 'createDepositAddress': false,
37
- 'createOrder': false,
38
- 'createStopLimitOrder': false,
39
- 'createStopMarketOrder': false,
40
- 'createStopOrder': false,
41
- 'editOrder': false,
42
- 'fetchBalance': false,
43
- 'fetchBorrowInterest': false,
44
- 'fetchBorrowRateHistories': false,
45
- 'fetchBorrowRateHistory': false,
46
- 'fetchClosedOrders': false,
47
- 'fetchCrossBorrowRate': false,
48
- 'fetchCrossBorrowRates': false,
49
- 'fetchCurrencies': false,
50
- 'fetchDepositAddress': false,
51
- 'fetchDeposits': false,
52
- 'fetchFundingHistory': false,
53
- 'fetchFundingRate': false,
54
- 'fetchFundingRateHistory': false,
55
- 'fetchFundingRates': false,
56
- 'fetchIndexOHLCV': false,
57
- 'fetchIsolatedBorrowRate': false,
58
- 'fetchIsolatedBorrowRates': false,
59
- 'fetchL2OrderBook': false,
60
- 'fetchL3OrderBook': false,
61
- 'fetchLedger': false,
62
- 'fetchLedgerEntry': false,
63
- 'fetchLeverageTiers': false,
64
- 'fetchMarkets': true,
65
- 'fetchMarkOHLCV': false,
66
- 'fetchMyTrades': false,
67
- 'fetchOHLCV': false,
68
- 'fetchOpenInterestHistory': false,
69
- 'fetchOpenOrders': false,
70
- 'fetchOrder': false,
71
- 'fetchOrderBook': false,
72
- 'fetchOrders': false,
73
- 'fetchOrderTrades': 'emulated',
74
- 'fetchPositions': false,
75
- 'fetchPremiumIndexOHLCV': false,
76
- 'fetchTicker': true,
77
- 'fetchTickers': true,
78
- 'fetchTime': false,
79
- 'fetchTrades': false,
80
- 'fetchTradingFee': false,
81
- 'fetchTradingFees': false,
82
- 'fetchWithdrawals': false,
83
- 'setLeverage': false,
84
- 'setMarginMode': false,
85
- 'transfer': false,
86
- 'withdraw': false,
87
- },
88
- 'comment': 'This comment is optional',
89
- 'urls': {
90
- 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/bit24/64x64.png',
91
- 'api': {
92
- 'public': 'https://bit24.cash/api/',
93
- },
94
- 'www': 'https://bit24.cash/',
95
- 'doc': [
96
- 'https://bit24.cash/',
97
- ],
98
- },
99
- 'api': {
100
- 'public': {
101
- 'get': {
102
- 'pro/v3/markets': 1,
103
- },
104
- },
105
- },
106
- 'fees': {},
107
- });
108
- }
109
- async fetchMarkets(params = {}) {
110
- /**
111
- * @method
112
- * @name bit24#fetchMarkets
113
- * @description retrieves data on all markets for bit24 with pagination
114
- * @see https://bit24.cash/api/pro/v3/markets
115
- * @param {object} [params] extra parameters specific to the exchange API endpoint
116
- * @returns {object[]} an array of objects representing market data
117
- */
118
- const result = [];
119
- let page = 1;
120
- const limit = 100; // check Bit24 docs for max allowed per page
121
- while (true) {
122
- const response = await this.publicGetProV3Markets(this.extend(params, {
123
- 'page': page,
124
- 'per_page': limit,
125
- }));
126
- const markets = this.safeDict(response, 'data');
127
- const marketList = this.safeList(markets, 'results', []);
128
- for (let i = 0; i < marketList.length; i++) {
129
- const marketdata = marketList[i];
130
- const market = this.parseMarket(marketdata);
131
- result.push(market);
132
- }
133
- // stop condition: if fewer results than limit, last page reached
134
- if (marketList.length < limit) {
135
- break;
136
- }
137
- page += 1;
138
- }
139
- return result;
140
- }
141
- parseMarket(market) {
142
- // {
143
- // id: 59,
144
- // market_name: "FTT/IRT",
145
- // quote_coin_decimal: 0,
146
- // base_coin_decimal: 2,
147
- // each_price: "83669.0000000000000000",
148
- // is_favorite: false,
149
- // max_leverage: null,
150
- // margin_profit_retention_fee: null,
151
- // margin_order_expire_days: null,
152
- // max_long_margin_leverage: null,
153
- // max_short_margin_leverage: null,
154
- // base_coin: {
155
- // symbol: "FTT",
156
- // name: "FTX Token",
157
- // fa_name: "اف تی ایکس توکن",
158
- // logo: "https://exchange-storage.bit24.cash/exchange/icons/ftt.png",
159
- // coin_type: 0
160
- // },
161
- // quote_coin: {
162
- // symbol: "IRT",
163
- // name: "Toman",
164
- // fa_name: "تومان",
165
- // logo: "https://exchange-storage.bit24.cash/exchange/icons/IRT.png",
166
- // coin_type: 1
167
- // },
168
- // margin_order_status: {
169
- // index: 0,
170
- // name: "غیرفعال"
171
- // },
172
- // bot_order_status: {
173
- // index: 1,
174
- // name: "فعال"
175
- // },
176
- // market_24h_information: {
177
- // base_volume: "467.86",
178
- // quote_volume: "39880070",
179
- // change_percent: "-1.687",
180
- // change_amount: "-1436",
181
- // min_price: "83137",
182
- // max_price: "87128",
183
- // first_price: "85105",
184
- // last_price: "83669"
185
- // }
186
- // }
187
- const base_coin = this.safeDict(market, 'base_coin');
188
- let baseId = this.safeString(base_coin, 'symbol');
189
- const quote_coin = this.safeDict(market, 'quote_coin');
190
- let quoteId = this.safeString(quote_coin, 'symbol');
191
- const base = this.safeCurrencyCode(baseId);
192
- const quote = this.safeCurrencyCode(quoteId);
193
- baseId = baseId.toLowerCase();
194
- quoteId = quoteId.toLowerCase();
195
- const id = baseId + '-' + quoteId;
196
- return {
197
- 'id': id,
198
- 'symbol': base + '/' + quote,
199
- 'base': base,
200
- 'quote': quote,
201
- 'settle': undefined,
202
- 'baseId': baseId,
203
- 'quoteId': quoteId,
204
- 'settleId': undefined,
205
- 'type': 'otc',
206
- 'spot': false,
207
- 'margin': false,
208
- 'swap': false,
209
- 'future': false,
210
- 'option': false,
211
- 'active': true,
212
- 'contract': false,
213
- 'linear': undefined,
214
- 'inverse': undefined,
215
- 'contractSize': undefined,
216
- 'expiry': undefined,
217
- 'expiryDatetime': undefined,
218
- 'strike': undefined,
219
- 'optionType': undefined,
220
- 'precision': {
221
- 'amount': undefined,
222
- 'price': undefined,
223
- },
224
- 'limits': {
225
- 'leverage': {
226
- 'min': undefined,
227
- 'max': undefined,
228
- },
229
- 'amount': {
230
- 'min': undefined,
231
- 'max': undefined,
232
- },
233
- 'price': {
234
- 'min': undefined,
235
- 'max': undefined,
236
- },
237
- 'cost': {
238
- 'min': undefined,
239
- 'max': undefined,
240
- },
241
- },
242
- 'created': undefined,
243
- 'info': market,
244
- };
245
- }
246
- async fetchTickers(symbols = undefined, params = {}) {
247
- /**
248
- * @method
249
- * @name bit24#fetchTickers
250
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
251
- * @see https://bit24.com/pro/v3/tickers
252
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
253
- * @param {object} [params] extra parameters specific to the exchange API endpoint
254
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
255
- */
256
- await this.loadMarkets();
257
- if (symbols !== undefined) {
258
- symbols = this.marketSymbols(symbols);
259
- }
260
- let page = 1;
261
- const limit = 100; // adjust if Bit24 docs show a different default
262
- const result = {};
263
- while (true) {
264
- const response = await this.publicGetProV3Markets(this.extend(params, {
265
- 'page': page,
266
- 'per_page': limit,
267
- }));
268
- const data = this.safeDict(response, 'data', {});
269
- const tickerList = this.safeList(data, 'results', []);
270
- for (let i = 0; i < tickerList.length; i++) {
271
- const tickerData = tickerList[i];
272
- const ticker = this.parseTicker(tickerData);
273
- const symbol = ticker['symbol'];
274
- result[symbol] = ticker;
275
- }
276
- if (tickerList.length < limit) {
277
- break;
278
- }
279
- page += 1;
280
- }
281
- return this.filterByArrayTickers(result, 'symbol', symbols);
282
- }
283
- async fetchTicker(symbol, params = {}) {
284
- /**
285
- * @method
286
- * @name bit24#fetchTicker
287
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
288
- * @see https://bit24.com/management/all-coins/?format=json
289
- * @param {string} symbol unified symbol of the market to fetch the ticker for
290
- * @param {object} [params] extra parameters specific to the exchange API endpoint
291
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
292
- */
293
- const ticker = await this.fetchTickers([symbol]);
294
- return ticker[symbol];
295
- }
296
- parseTicker(ticker, market = undefined) {
297
- // {
298
- // id: 59,
299
- // market_name: "FTT/IRT",
300
- // quote_coin_decimal: 0,
301
- // base_coin_decimal: 2,
302
- // each_price: "83669.0000000000000000",
303
- // is_favorite: false,
304
- // max_leverage: null,
305
- // margin_profit_retention_fee: null,
306
- // margin_order_expire_days: null,
307
- // max_long_margin_leverage: null,
308
- // max_short_margin_leverage: null,
309
- // base_coin: {
310
- // symbol: "FTT",
311
- // name: "FTX Token",
312
- // fa_name: "اف تی ایکس توکن",
313
- // logo: "https://exchange-storage.bit24.cash/exchange/icons/ftt.png",
314
- // coin_type: 0
315
- // },
316
- // quote_coin: {
317
- // symbol: "IRT",
318
- // name: "Toman",
319
- // fa_name: "تومان",
320
- // logo: "https://exchange-storage.bit24.cash/exchange/icons/IRT.png",
321
- // coin_type: 1
322
- // },
323
- // margin_order_status: {
324
- // index: 0,
325
- // name: "غیرفعال"
326
- // },
327
- // bot_order_status: {
328
- // index: 1,
329
- // name: "فعال"
330
- // },
331
- // market_24h_information: {
332
- // base_volume: "467.86",
333
- // quote_volume: "39880070",
334
- // change_percent: "-1.687",
335
- // change_amount: "-1436",
336
- // min_price: "83137",
337
- // max_price: "87128",
338
- // first_price: "85105",
339
- // last_price: "83669"
340
- // }
341
- // },
342
- const marketType = 'spot';
343
- const base_coin = this.safeDict(ticker, 'base_coin', {});
344
- let base_symbol = this.safeString(base_coin, 'symbol');
345
- base_symbol = base_symbol.toLowerCase();
346
- const quote_coin = this.safeDict(ticker, 'quote_coin', {});
347
- let quote_symbol = this.safeString(quote_coin, 'symbol');
348
- quote_symbol = quote_symbol.toLowerCase();
349
- const marketId = base_symbol + '-' + quote_symbol;
350
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
351
- const last = this.safeFloat(ticker, 'each_price', 0);
352
- const markerInfo = this.safeDict(ticker, 'market_24h_information', {});
353
- const change = this.safeFloat(markerInfo, 'change_percent', 0);
354
- const minPrice = this.safeFloat(markerInfo, 'min_price', 0);
355
- const maxPrice = this.safeFloat(markerInfo, 'max_price', 0);
356
- const baseVolume = this.safeFloat(markerInfo, 'base_volume', 0);
357
- const quoteVolume = this.safeFloat(markerInfo, 'quote_volume', 0);
358
- return this.safeTicker({
359
- 'symbol': symbol,
360
- 'timestamp': undefined,
361
- 'datetime': undefined,
362
- 'high': maxPrice,
363
- 'low': minPrice,
364
- 'bid': undefined,
365
- 'bidVolume': undefined,
366
- 'ask': undefined,
367
- 'askVolume': undefined,
368
- 'vwap': undefined,
369
- 'open': undefined,
370
- 'close': last,
371
- 'last': last,
372
- 'previousClose': undefined,
373
- 'change': change,
374
- 'percentage': undefined,
375
- 'average': undefined,
376
- 'baseVolume': baseVolume,
377
- 'quoteVolume': quoteVolume,
378
- 'info': ticker,
379
- }, market);
380
- }
381
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
382
- const query = this.omit(params, this.extractParams(path));
383
- let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
384
- url = url + '?' + this.urlencode(query);
385
- headers = { 'Content-Type': 'application/json' };
386
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
387
- }
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class bit24
11
+ * @augments Exchange
12
+ * @description Set rateLimit to 1000 if fully verified
13
+ */
14
+ class bit24 extends bit24$1["default"] {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'bit24',
18
+ 'name': 'Bit24',
19
+ 'countries': ['IR'],
20
+ 'rateLimit': 1000,
21
+ 'version': '1',
22
+ 'certified': false,
23
+ 'pro': false,
24
+ 'has': {
25
+ 'CORS': undefined,
26
+ 'spot': false,
27
+ 'margin': false,
28
+ 'swap': false,
29
+ 'future': false,
30
+ 'option': false,
31
+ 'addMargin': false,
32
+ 'cancelAllOrders': false,
33
+ 'cancelOrder': false,
34
+ 'cancelOrders': false,
35
+ 'createDepositAddress': false,
36
+ 'createOrder': false,
37
+ 'createStopLimitOrder': false,
38
+ 'createStopMarketOrder': false,
39
+ 'createStopOrder': false,
40
+ 'editOrder': false,
41
+ 'fetchBalance': false,
42
+ 'fetchBorrowInterest': false,
43
+ 'fetchBorrowRateHistories': false,
44
+ 'fetchBorrowRateHistory': false,
45
+ 'fetchClosedOrders': false,
46
+ 'fetchCrossBorrowRate': false,
47
+ 'fetchCrossBorrowRates': false,
48
+ 'fetchCurrencies': false,
49
+ 'fetchDepositAddress': false,
50
+ 'fetchDeposits': false,
51
+ 'fetchFundingHistory': false,
52
+ 'fetchFundingRate': false,
53
+ 'fetchFundingRateHistory': false,
54
+ 'fetchFundingRates': false,
55
+ 'fetchIndexOHLCV': false,
56
+ 'fetchIsolatedBorrowRate': false,
57
+ 'fetchIsolatedBorrowRates': false,
58
+ 'fetchL2OrderBook': false,
59
+ 'fetchL3OrderBook': false,
60
+ 'fetchLedger': false,
61
+ 'fetchLedgerEntry': false,
62
+ 'fetchLeverageTiers': false,
63
+ 'fetchMarkets': true,
64
+ 'fetchMarkOHLCV': false,
65
+ 'fetchMyTrades': false,
66
+ 'fetchOHLCV': false,
67
+ 'fetchOpenInterestHistory': false,
68
+ 'fetchOpenOrders': false,
69
+ 'fetchOrder': false,
70
+ 'fetchOrderBook': false,
71
+ 'fetchOrders': false,
72
+ 'fetchOrderTrades': 'emulated',
73
+ 'fetchPositions': false,
74
+ 'fetchPremiumIndexOHLCV': false,
75
+ 'fetchTicker': true,
76
+ 'fetchTickers': true,
77
+ 'fetchTime': false,
78
+ 'fetchTrades': false,
79
+ 'fetchTradingFee': false,
80
+ 'fetchTradingFees': false,
81
+ 'fetchWithdrawals': false,
82
+ 'otc': true,
83
+ 'setLeverage': false,
84
+ 'setMarginMode': false,
85
+ 'transfer': false,
86
+ 'withdraw': false,
87
+ },
88
+ 'comment': 'This comment is optional',
89
+ 'urls': {
90
+ 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/bit24/64x64.png',
91
+ 'api': {
92
+ 'public': 'https://bit24.cash/api/',
93
+ },
94
+ 'www': 'https://bit24.cash/',
95
+ 'doc': [
96
+ 'https://bit24.cash/',
97
+ ],
98
+ },
99
+ 'api': {
100
+ 'public': {
101
+ 'get': {
102
+ 'pro/v3/markets': 1,
103
+ },
104
+ },
105
+ },
106
+ 'fees': {},
107
+ });
108
+ }
109
+ async fetchMarkets(params = {}) {
110
+ /**
111
+ * @method
112
+ * @name bit24#fetchMarkets
113
+ * @description retrieves data on all markets for bit24 with pagination
114
+ * @see https://bit24.cash/api/pro/v3/markets
115
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
116
+ * @returns {object[]} an array of objects representing market data
117
+ */
118
+ const result = [];
119
+ let page = 1;
120
+ const limit = 100; // check Bit24 docs for max allowed per page
121
+ while (true) {
122
+ const response = await this.publicGetProV3Markets(this.extend(params, {
123
+ 'page': page,
124
+ 'per_page': limit,
125
+ }));
126
+ const markets = this.safeDict(response, 'data');
127
+ const marketList = this.safeList(markets, 'results', []);
128
+ for (let i = 0; i < marketList.length; i++) {
129
+ const marketdata = marketList[i];
130
+ const market = this.parseMarket(marketdata);
131
+ result.push(market);
132
+ }
133
+ // stop condition: if fewer results than limit, last page reached
134
+ if (marketList.length < limit) {
135
+ break;
136
+ }
137
+ page += 1;
138
+ }
139
+ return result;
140
+ }
141
+ parseMarket(market) {
142
+ // {
143
+ // id: 59,
144
+ // market_name: "FTT/IRT",
145
+ // quote_coin_decimal: 0,
146
+ // base_coin_decimal: 2,
147
+ // each_price: "83669.0000000000000000",
148
+ // is_favorite: false,
149
+ // max_leverage: null,
150
+ // margin_profit_retention_fee: null,
151
+ // margin_order_expire_days: null,
152
+ // max_long_margin_leverage: null,
153
+ // max_short_margin_leverage: null,
154
+ // base_coin: {
155
+ // symbol: "FTT",
156
+ // name: "FTX Token",
157
+ // fa_name: "اف تی ایکس توکن",
158
+ // logo: "https://exchange-storage.bit24.cash/exchange/icons/ftt.png",
159
+ // coin_type: 0
160
+ // },
161
+ // quote_coin: {
162
+ // symbol: "IRT",
163
+ // name: "Toman",
164
+ // fa_name: "تومان",
165
+ // logo: "https://exchange-storage.bit24.cash/exchange/icons/IRT.png",
166
+ // coin_type: 1
167
+ // },
168
+ // margin_order_status: {
169
+ // index: 0,
170
+ // name: "غیرفعال"
171
+ // },
172
+ // bot_order_status: {
173
+ // index: 1,
174
+ // name: "فعال"
175
+ // },
176
+ // market_24h_information: {
177
+ // base_volume: "467.86",
178
+ // quote_volume: "39880070",
179
+ // change_percent: "-1.687",
180
+ // change_amount: "-1436",
181
+ // min_price: "83137",
182
+ // max_price: "87128",
183
+ // first_price: "85105",
184
+ // last_price: "83669"
185
+ // }
186
+ // }
187
+ const base_coin = this.safeDict(market, 'base_coin');
188
+ let baseId = this.safeString(base_coin, 'symbol');
189
+ const quote_coin = this.safeDict(market, 'quote_coin');
190
+ let quoteId = this.safeString(quote_coin, 'symbol');
191
+ const base = this.safeCurrencyCode(baseId);
192
+ const quote = this.safeCurrencyCode(quoteId);
193
+ baseId = baseId.toLowerCase();
194
+ quoteId = quoteId.toLowerCase();
195
+ const id = baseId + '-' + quoteId;
196
+ return {
197
+ 'id': id,
198
+ 'symbol': base + '/' + quote,
199
+ 'base': base,
200
+ 'quote': quote,
201
+ 'settle': undefined,
202
+ 'baseId': baseId,
203
+ 'quoteId': quoteId,
204
+ 'settleId': undefined,
205
+ 'type': 'otc',
206
+ 'spot': false,
207
+ 'margin': false,
208
+ 'swap': false,
209
+ 'future': false,
210
+ 'option': false,
211
+ 'active': true,
212
+ 'contract': false,
213
+ 'linear': undefined,
214
+ 'inverse': undefined,
215
+ 'contractSize': undefined,
216
+ 'expiry': undefined,
217
+ 'expiryDatetime': undefined,
218
+ 'strike': undefined,
219
+ 'optionType': undefined,
220
+ 'precision': {
221
+ 'amount': undefined,
222
+ 'price': undefined,
223
+ },
224
+ 'limits': {
225
+ 'leverage': {
226
+ 'min': undefined,
227
+ 'max': undefined,
228
+ },
229
+ 'amount': {
230
+ 'min': undefined,
231
+ 'max': undefined,
232
+ },
233
+ 'price': {
234
+ 'min': undefined,
235
+ 'max': undefined,
236
+ },
237
+ 'cost': {
238
+ 'min': undefined,
239
+ 'max': undefined,
240
+ },
241
+ },
242
+ 'created': undefined,
243
+ 'info': market,
244
+ };
245
+ }
246
+ async fetchTickers(symbols = undefined, params = {}) {
247
+ /**
248
+ * @method
249
+ * @name bit24#fetchTickers
250
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
251
+ * @see https://bit24.com/pro/v3/tickers
252
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
253
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
254
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
255
+ */
256
+ await this.loadMarkets();
257
+ if (symbols !== undefined) {
258
+ symbols = this.marketSymbols(symbols);
259
+ }
260
+ let page = 1;
261
+ const limit = 100; // adjust if Bit24 docs show a different default
262
+ const result = {};
263
+ while (true) {
264
+ const response = await this.publicGetProV3Markets(this.extend(params, {
265
+ 'page': page,
266
+ 'per_page': limit,
267
+ }));
268
+ const data = this.safeDict(response, 'data', {});
269
+ const tickerList = this.safeList(data, 'results', []);
270
+ for (let i = 0; i < tickerList.length; i++) {
271
+ const tickerData = tickerList[i];
272
+ const ticker = this.parseTicker(tickerData);
273
+ const symbol = ticker['symbol'];
274
+ result[symbol] = ticker;
275
+ }
276
+ if (tickerList.length < limit) {
277
+ break;
278
+ }
279
+ page += 1;
280
+ }
281
+ return this.filterByArrayTickers(result, 'symbol', symbols);
282
+ }
283
+ async fetchTicker(symbol, params = {}) {
284
+ /**
285
+ * @method
286
+ * @name bit24#fetchTicker
287
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
288
+ * @see https://bit24.com/management/all-coins/?format=json
289
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
290
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
291
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
292
+ */
293
+ const ticker = await this.fetchTickers([symbol]);
294
+ return ticker[symbol];
295
+ }
296
+ parseTicker(ticker, market = undefined) {
297
+ // {
298
+ // id: 59,
299
+ // market_name: "FTT/IRT",
300
+ // quote_coin_decimal: 0,
301
+ // base_coin_decimal: 2,
302
+ // each_price: "83669.0000000000000000",
303
+ // is_favorite: false,
304
+ // max_leverage: null,
305
+ // margin_profit_retention_fee: null,
306
+ // margin_order_expire_days: null,
307
+ // max_long_margin_leverage: null,
308
+ // max_short_margin_leverage: null,
309
+ // base_coin: {
310
+ // symbol: "FTT",
311
+ // name: "FTX Token",
312
+ // fa_name: "اف تی ایکس توکن",
313
+ // logo: "https://exchange-storage.bit24.cash/exchange/icons/ftt.png",
314
+ // coin_type: 0
315
+ // },
316
+ // quote_coin: {
317
+ // symbol: "IRT",
318
+ // name: "Toman",
319
+ // fa_name: "تومان",
320
+ // logo: "https://exchange-storage.bit24.cash/exchange/icons/IRT.png",
321
+ // coin_type: 1
322
+ // },
323
+ // margin_order_status: {
324
+ // index: 0,
325
+ // name: "غیرفعال"
326
+ // },
327
+ // bot_order_status: {
328
+ // index: 1,
329
+ // name: "فعال"
330
+ // },
331
+ // market_24h_information: {
332
+ // base_volume: "467.86",
333
+ // quote_volume: "39880070",
334
+ // change_percent: "-1.687",
335
+ // change_amount: "-1436",
336
+ // min_price: "83137",
337
+ // max_price: "87128",
338
+ // first_price: "85105",
339
+ // last_price: "83669"
340
+ // }
341
+ // },
342
+ const marketType = 'spot';
343
+ const base_coin = this.safeDict(ticker, 'base_coin', {});
344
+ let base_symbol = this.safeString(base_coin, 'symbol');
345
+ base_symbol = base_symbol.toLowerCase();
346
+ const quote_coin = this.safeDict(ticker, 'quote_coin', {});
347
+ let quote_symbol = this.safeString(quote_coin, 'symbol');
348
+ quote_symbol = quote_symbol.toLowerCase();
349
+ const marketId = base_symbol + '-' + quote_symbol;
350
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
351
+ const last = this.safeFloat(ticker, 'each_price', 0);
352
+ const markerInfo = this.safeDict(ticker, 'market_24h_information', {});
353
+ const change = this.safeFloat(markerInfo, 'change_percent', 0);
354
+ const minPrice = this.safeFloat(markerInfo, 'min_price', 0);
355
+ const maxPrice = this.safeFloat(markerInfo, 'max_price', 0);
356
+ const baseVolume = this.safeFloat(markerInfo, 'base_volume', 0);
357
+ const quoteVolume = this.safeFloat(markerInfo, 'quote_volume', 0);
358
+ return this.safeTicker({
359
+ 'symbol': symbol,
360
+ 'timestamp': undefined,
361
+ 'datetime': undefined,
362
+ 'high': maxPrice,
363
+ 'low': minPrice,
364
+ 'bid': undefined,
365
+ 'bidVolume': undefined,
366
+ 'ask': undefined,
367
+ 'askVolume': undefined,
368
+ 'vwap': undefined,
369
+ 'open': undefined,
370
+ 'close': last,
371
+ 'last': last,
372
+ 'previousClose': undefined,
373
+ 'change': change,
374
+ 'percentage': undefined,
375
+ 'average': undefined,
376
+ 'baseVolume': baseVolume,
377
+ 'quoteVolume': quoteVolume,
378
+ 'info': ticker,
379
+ }, market);
380
+ }
381
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
382
+ const query = this.omit(params, this.extractParams(path));
383
+ let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
384
+ url = url + '?' + this.urlencode(query);
385
+ headers = { 'Content-Type': 'application/json' };
386
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
387
+ }
388
388
  }
389
389
 
390
390
  exports["default"] = bit24;