ccxt-ir 4.9.23 → 4.9.27

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