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/README.md +4 -4
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/abstract/iranexchange.js +1 -1
- package/dist/cjs/src/bit24.js +380 -379
- package/dist/cjs/src/bitpin.js +478 -469
- package/dist/cjs/src/iranexchange.js +390 -388
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitpin.d.ts +11 -10
- package/js/src/abstract/iranexchange.d.ts +9 -9
- package/js/src/abstract/iranexchange.js +5 -5
- package/js/src/base/Exchange.d.ts +926 -926
- package/js/src/bit24.js +383 -382
- package/js/src/bitpin.js +481 -472
- package/js/src/coinbaseexchange.d.ts +334 -334
- package/js/src/iranexchange.d.ts +21 -21
- package/js/src/iranexchange.js +393 -391
- package/js/src/protobuf/mexc/compiled.d.cts +2 -2
- package/js/src/static_dependencies/fflake/browser.d.ts +222 -222
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
- package/js/src/static_dependencies/qs/formats.d.cts +8 -8
- package/js/src/static_dependencies/qs/index.d.cts +4 -4
- package/js/src/static_dependencies/qs/parse.d.cts +2 -2
- package/js/src/static_dependencies/qs/stringify.d.cts +2 -2
- package/js/src/static_dependencies/qs/utils.d.cts +9 -9
- package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
- package/package.json +1 -1
package/dist/cjs/src/bit24.js
CHANGED
|
@@ -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':
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
'
|
|
49
|
-
'
|
|
50
|
-
'
|
|
51
|
-
'
|
|
52
|
-
'
|
|
53
|
-
'
|
|
54
|
-
'
|
|
55
|
-
'
|
|
56
|
-
'
|
|
57
|
-
'
|
|
58
|
-
'
|
|
59
|
-
'
|
|
60
|
-
'
|
|
61
|
-
'
|
|
62
|
-
'
|
|
63
|
-
'
|
|
64
|
-
'
|
|
65
|
-
'
|
|
66
|
-
'
|
|
67
|
-
'
|
|
68
|
-
'
|
|
69
|
-
'
|
|
70
|
-
'
|
|
71
|
-
'
|
|
72
|
-
'
|
|
73
|
-
'
|
|
74
|
-
'
|
|
75
|
-
'
|
|
76
|
-
'
|
|
77
|
-
'
|
|
78
|
-
'
|
|
79
|
-
'
|
|
80
|
-
'
|
|
81
|
-
'
|
|
82
|
-
'
|
|
83
|
-
'
|
|
84
|
-
'
|
|
85
|
-
'
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
'
|
|
89
|
-
|
|
90
|
-
'
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
'
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
* @
|
|
112
|
-
* @
|
|
113
|
-
* @
|
|
114
|
-
* @
|
|
115
|
-
* @
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
'
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
if
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
//
|
|
143
|
-
//
|
|
144
|
-
//
|
|
145
|
-
//
|
|
146
|
-
//
|
|
147
|
-
//
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
//
|
|
151
|
-
//
|
|
152
|
-
//
|
|
153
|
-
//
|
|
154
|
-
//
|
|
155
|
-
//
|
|
156
|
-
//
|
|
157
|
-
//
|
|
158
|
-
//
|
|
159
|
-
//
|
|
160
|
-
//
|
|
161
|
-
//
|
|
162
|
-
//
|
|
163
|
-
//
|
|
164
|
-
//
|
|
165
|
-
//
|
|
166
|
-
//
|
|
167
|
-
//
|
|
168
|
-
//
|
|
169
|
-
//
|
|
170
|
-
//
|
|
171
|
-
//
|
|
172
|
-
//
|
|
173
|
-
//
|
|
174
|
-
//
|
|
175
|
-
//
|
|
176
|
-
//
|
|
177
|
-
//
|
|
178
|
-
//
|
|
179
|
-
//
|
|
180
|
-
//
|
|
181
|
-
//
|
|
182
|
-
//
|
|
183
|
-
//
|
|
184
|
-
//
|
|
185
|
-
// }
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
'
|
|
198
|
-
'
|
|
199
|
-
'
|
|
200
|
-
'
|
|
201
|
-
'
|
|
202
|
-
'
|
|
203
|
-
'
|
|
204
|
-
'
|
|
205
|
-
'
|
|
206
|
-
'
|
|
207
|
-
'
|
|
208
|
-
'
|
|
209
|
-
'
|
|
210
|
-
'
|
|
211
|
-
'
|
|
212
|
-
'
|
|
213
|
-
'
|
|
214
|
-
'
|
|
215
|
-
'
|
|
216
|
-
'
|
|
217
|
-
'
|
|
218
|
-
'
|
|
219
|
-
'
|
|
220
|
-
|
|
221
|
-
'
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
'
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
'
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
'
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
'
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
'
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
* @
|
|
249
|
-
* @
|
|
250
|
-
* @
|
|
251
|
-
* @
|
|
252
|
-
* @param {
|
|
253
|
-
* @
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
'
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
const
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
* @
|
|
286
|
-
* @
|
|
287
|
-
* @
|
|
288
|
-
* @
|
|
289
|
-
* @param {
|
|
290
|
-
* @
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
//
|
|
298
|
-
//
|
|
299
|
-
//
|
|
300
|
-
//
|
|
301
|
-
//
|
|
302
|
-
//
|
|
303
|
-
//
|
|
304
|
-
//
|
|
305
|
-
//
|
|
306
|
-
//
|
|
307
|
-
//
|
|
308
|
-
//
|
|
309
|
-
//
|
|
310
|
-
//
|
|
311
|
-
//
|
|
312
|
-
//
|
|
313
|
-
//
|
|
314
|
-
//
|
|
315
|
-
//
|
|
316
|
-
//
|
|
317
|
-
//
|
|
318
|
-
//
|
|
319
|
-
//
|
|
320
|
-
//
|
|
321
|
-
//
|
|
322
|
-
//
|
|
323
|
-
//
|
|
324
|
-
//
|
|
325
|
-
//
|
|
326
|
-
//
|
|
327
|
-
//
|
|
328
|
-
//
|
|
329
|
-
//
|
|
330
|
-
//
|
|
331
|
-
//
|
|
332
|
-
//
|
|
333
|
-
//
|
|
334
|
-
//
|
|
335
|
-
//
|
|
336
|
-
//
|
|
337
|
-
//
|
|
338
|
-
//
|
|
339
|
-
//
|
|
340
|
-
// }
|
|
341
|
-
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
base_symbol =
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
quote_symbol =
|
|
348
|
-
|
|
349
|
-
const
|
|
350
|
-
const
|
|
351
|
-
const
|
|
352
|
-
const
|
|
353
|
-
const
|
|
354
|
-
const
|
|
355
|
-
const
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
'
|
|
360
|
-
'
|
|
361
|
-
'
|
|
362
|
-
'
|
|
363
|
-
'
|
|
364
|
-
'
|
|
365
|
-
'
|
|
366
|
-
'
|
|
367
|
-
'
|
|
368
|
-
'
|
|
369
|
-
'
|
|
370
|
-
'
|
|
371
|
-
'
|
|
372
|
-
'
|
|
373
|
-
'
|
|
374
|
-
'
|
|
375
|
-
'
|
|
376
|
-
'
|
|
377
|
-
'
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
url =
|
|
384
|
-
|
|
385
|
-
|
|
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;
|