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