ccxt-ir 4.9.31 → 4.10.0
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 +4 -1
- package/dist/cjs/src/abstract/asretether.js +11 -0
- package/dist/cjs/src/asretether.js +325 -0
- package/dist/cjs/src/bit24.js +138 -3
- package/dist/cjs/src/raastin.js +144 -16
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- package/js/src/abstract/asretether.d.ts +8 -0
- package/js/src/abstract/asretether.js +11 -0
- package/js/src/abstract/bit24.d.ts +1 -0
- package/js/src/abstract/raastin.d.ts +1 -0
- package/js/src/asretether.d.ts +21 -0
- package/js/src/asretether.js +324 -0
- package/js/src/bit24.d.ts +3 -0
- package/js/src/bit24.js +138 -3
- package/js/src/raastin.d.ts +2 -0
- package/js/src/raastin.js +144 -16
- package/js/test.js +16 -16
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -19,6 +19,7 @@ var apex = require('./src/apex.js');
|
|
|
19
19
|
var arzinja = require('./src/arzinja.js');
|
|
20
20
|
var arzplus = require('./src/arzplus.js');
|
|
21
21
|
var ascendex = require('./src/ascendex.js');
|
|
22
|
+
var asretether = require('./src/asretether.js');
|
|
22
23
|
var bequant = require('./src/bequant.js');
|
|
23
24
|
var bigone = require('./src/bigone.js');
|
|
24
25
|
var binance = require('./src/binance.js');
|
|
@@ -235,7 +236,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
235
236
|
|
|
236
237
|
//-----------------------------------------------------------------------------
|
|
237
238
|
// this is updated by vss.js when building
|
|
238
|
-
const version = '4.
|
|
239
|
+
const version = '4.10.0';
|
|
239
240
|
Exchange["default"].ccxtVersion = version;
|
|
240
241
|
const exchanges = {
|
|
241
242
|
'abantether': abantether["default"],
|
|
@@ -245,6 +246,7 @@ const exchanges = {
|
|
|
245
246
|
'arzinja': arzinja["default"],
|
|
246
247
|
'arzplus': arzplus["default"],
|
|
247
248
|
'ascendex': ascendex["default"],
|
|
249
|
+
'asretether': asretether["default"],
|
|
248
250
|
'bequant': bequant["default"],
|
|
249
251
|
'bigone': bigone["default"],
|
|
250
252
|
'binance': binance["default"],
|
|
@@ -519,6 +521,7 @@ exports.apex = apex["default"];
|
|
|
519
521
|
exports.arzinja = arzinja["default"];
|
|
520
522
|
exports.arzplus = arzplus["default"];
|
|
521
523
|
exports.ascendex = ascendex["default"];
|
|
524
|
+
exports.asretether = asretether["default"];
|
|
522
525
|
exports.bequant = bequant["default"];
|
|
523
526
|
exports.bigone = bigone["default"];
|
|
524
527
|
exports.binance = binance["default"];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var Exchange$1 = require('../base/Exchange.js');
|
|
6
|
+
|
|
7
|
+
// ----------------------------------------------------------------------------
|
|
8
|
+
class Exchange extends Exchange$1["default"] {
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
exports["default"] = Exchange;
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var asretether$1 = require('./abstract/asretether.js');
|
|
6
|
+
|
|
7
|
+
// ----------------------------------------------------------------------------
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
/**
|
|
10
|
+
* @class asretether
|
|
11
|
+
* @augments Exchange
|
|
12
|
+
* @description Set rateLimit to 1000 if fully verified
|
|
13
|
+
*/
|
|
14
|
+
class asretether extends asretether$1["default"] {
|
|
15
|
+
describe() {
|
|
16
|
+
return this.deepExtend(super.describe(), {
|
|
17
|
+
'id': 'asretether',
|
|
18
|
+
'name': 'Asretether',
|
|
19
|
+
'countries': ['IR'],
|
|
20
|
+
'rateLimit': 1000,
|
|
21
|
+
'version': '2',
|
|
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': false,
|
|
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': 'OTC market for USDT and other cryptocurrencies',
|
|
89
|
+
'urls': {
|
|
90
|
+
'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/asretether/64x64.png',
|
|
91
|
+
'api': {
|
|
92
|
+
'public': 'https://api.asretether.com',
|
|
93
|
+
},
|
|
94
|
+
'www': 'https://asretether.com',
|
|
95
|
+
'doc': [
|
|
96
|
+
'https://api.asretether.com/docs',
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
'api': {
|
|
100
|
+
'public': {
|
|
101
|
+
'get': {
|
|
102
|
+
'v2/market': 1,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
'fees': {
|
|
107
|
+
'trading': {
|
|
108
|
+
'tierBased': false,
|
|
109
|
+
'percentage': true,
|
|
110
|
+
'maker': this.parseNumber('0'),
|
|
111
|
+
'taker': this.parseNumber('0'),
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
async fetchMarkets(params = {}) {
|
|
117
|
+
/**
|
|
118
|
+
* @method
|
|
119
|
+
* @name asretether#fetchMarkets
|
|
120
|
+
* @description retrieves data on all markets for asretether
|
|
121
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
122
|
+
* @returns {object[]} an array of objects representing market data
|
|
123
|
+
*/
|
|
124
|
+
const response = await this.publicGetV2Market(params);
|
|
125
|
+
const data = this.safeList(response, 'data', []);
|
|
126
|
+
const result = [];
|
|
127
|
+
for (let i = 0; i < data.length; i++) {
|
|
128
|
+
const market = this.parseMarket(data[i]);
|
|
129
|
+
result.push(market);
|
|
130
|
+
}
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
133
|
+
parseMarket(market) {
|
|
134
|
+
// {
|
|
135
|
+
// id: 2,
|
|
136
|
+
// symbol: "USDT-IRT",
|
|
137
|
+
// status: "ACTIVE",
|
|
138
|
+
// high_24h: "181978",
|
|
139
|
+
// low_24h: "172874",
|
|
140
|
+
// irt_high_24h: 0,
|
|
141
|
+
// irt_low_24h: 0,
|
|
142
|
+
// change_24h: 0,
|
|
143
|
+
// volume_24h: 100000,
|
|
144
|
+
// price: {
|
|
145
|
+
// price_buy: "178410",
|
|
146
|
+
// price_sell: "176402",
|
|
147
|
+
// price_in_tether: "1.0000"
|
|
148
|
+
// },
|
|
149
|
+
// base_currency: {
|
|
150
|
+
// slug: "USDT",
|
|
151
|
+
// decimals: 6,
|
|
152
|
+
// full_name: "Tether",
|
|
153
|
+
// persian_name: "تتر",
|
|
154
|
+
// icon_url: "https://box.asretether.com/currency-icons/usdt.png"
|
|
155
|
+
// },
|
|
156
|
+
// quote_currency: {
|
|
157
|
+
// slug: "IRT",
|
|
158
|
+
// decimals: 0,
|
|
159
|
+
// full_name: "IR Toman",
|
|
160
|
+
// persian_name: "تومان",
|
|
161
|
+
// icon_url: "https://box.asretether.com/currency-icons/irt.png"
|
|
162
|
+
// }
|
|
163
|
+
// },
|
|
164
|
+
const id = this.safeString(market, 'symbol');
|
|
165
|
+
const baseCurrency = this.safeDict(market, 'base_currency', {});
|
|
166
|
+
const quoteCurrency = this.safeDict(market, 'quote_currency', {});
|
|
167
|
+
const baseId = this.safeString(baseCurrency, 'slug');
|
|
168
|
+
const quoteId = this.safeString(quoteCurrency, 'slug');
|
|
169
|
+
const base = this.safeCurrencyCode(baseId);
|
|
170
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
171
|
+
const basePrecision = this.safeInteger(baseCurrency, 'decimals');
|
|
172
|
+
const quotePrecision = this.safeInteger(quoteCurrency, 'decimals');
|
|
173
|
+
const status = this.safeString(market, 'status');
|
|
174
|
+
const enabled = status === 'ACTIVE';
|
|
175
|
+
return {
|
|
176
|
+
'id': id,
|
|
177
|
+
'symbol': base + '/' + quote,
|
|
178
|
+
'base': base,
|
|
179
|
+
'quote': quote,
|
|
180
|
+
'settle': undefined,
|
|
181
|
+
'baseId': baseId,
|
|
182
|
+
'quoteId': quoteId,
|
|
183
|
+
'settleId': undefined,
|
|
184
|
+
'type': 'otc',
|
|
185
|
+
'spot': false,
|
|
186
|
+
'margin': false,
|
|
187
|
+
'swap': false,
|
|
188
|
+
'future': false,
|
|
189
|
+
'option': false,
|
|
190
|
+
'active': enabled,
|
|
191
|
+
'contract': false,
|
|
192
|
+
'linear': undefined,
|
|
193
|
+
'inverse': undefined,
|
|
194
|
+
'contractSize': undefined,
|
|
195
|
+
'expiry': undefined,
|
|
196
|
+
'expiryDatetime': undefined,
|
|
197
|
+
'strike': undefined,
|
|
198
|
+
'optionType': undefined,
|
|
199
|
+
'precision': {
|
|
200
|
+
'amount': basePrecision,
|
|
201
|
+
'price': quotePrecision,
|
|
202
|
+
},
|
|
203
|
+
'limits': {
|
|
204
|
+
'leverage': {
|
|
205
|
+
'min': undefined,
|
|
206
|
+
'max': undefined,
|
|
207
|
+
},
|
|
208
|
+
'amount': {
|
|
209
|
+
'min': undefined,
|
|
210
|
+
'max': undefined,
|
|
211
|
+
},
|
|
212
|
+
'price': {
|
|
213
|
+
'min': undefined,
|
|
214
|
+
'max': undefined,
|
|
215
|
+
},
|
|
216
|
+
'cost': {
|
|
217
|
+
'min': undefined,
|
|
218
|
+
'max': undefined,
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
'created': undefined,
|
|
222
|
+
'info': market,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
async fetchTickers(symbols = undefined, params = {}) {
|
|
226
|
+
/**
|
|
227
|
+
* @method
|
|
228
|
+
* @name asretether#fetchTickers
|
|
229
|
+
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
230
|
+
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
231
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
232
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
233
|
+
*/
|
|
234
|
+
await this.loadMarkets();
|
|
235
|
+
if (symbols !== undefined) {
|
|
236
|
+
symbols = this.marketSymbols(symbols);
|
|
237
|
+
}
|
|
238
|
+
const response = await this.publicGetV2Market(params);
|
|
239
|
+
const data = this.safeList(response, 'data', []);
|
|
240
|
+
const result = {};
|
|
241
|
+
for (let i = 0; i < data.length; i++) {
|
|
242
|
+
const ticker = this.parseTicker(data[i]);
|
|
243
|
+
const symbol = ticker['symbol'];
|
|
244
|
+
result[symbol] = ticker;
|
|
245
|
+
}
|
|
246
|
+
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
247
|
+
}
|
|
248
|
+
async fetchTicker(symbol, params = {}) {
|
|
249
|
+
/**
|
|
250
|
+
* @method
|
|
251
|
+
* @name asretether#fetchTicker
|
|
252
|
+
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
253
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
254
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
255
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
256
|
+
*/
|
|
257
|
+
await this.loadMarkets();
|
|
258
|
+
const market = this.market(symbol);
|
|
259
|
+
const request = {
|
|
260
|
+
'symbol': market['id'],
|
|
261
|
+
};
|
|
262
|
+
const response = await this.publicGetV2Market(request);
|
|
263
|
+
const data = this.safeList(response, 'data', []);
|
|
264
|
+
if (data.length > 0) {
|
|
265
|
+
return this.parseTicker(data[0], market);
|
|
266
|
+
}
|
|
267
|
+
throw new Error('Ticker not found');
|
|
268
|
+
}
|
|
269
|
+
parseTicker(ticker, market = undefined) {
|
|
270
|
+
const baseCurrency = this.safeDict(ticker, 'base_currency', {});
|
|
271
|
+
const quoteCurrency = this.safeDict(ticker, 'quote_currency', {});
|
|
272
|
+
const baseId = this.safeString(baseCurrency, 'slug');
|
|
273
|
+
const quoteId = this.safeString(quoteCurrency, 'slug');
|
|
274
|
+
const base = this.safeCurrencyCode(baseId);
|
|
275
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
276
|
+
const symbol = base + '/' + quote;
|
|
277
|
+
// Handle price selection based on quote currency
|
|
278
|
+
const price = this.safeDict(ticker, 'price', {});
|
|
279
|
+
let last = undefined;
|
|
280
|
+
if (quote === 'IRT') {
|
|
281
|
+
last = this.safeFloat(price, 'price_sell');
|
|
282
|
+
}
|
|
283
|
+
else if (quote === 'USDT') {
|
|
284
|
+
last = this.safeFloat(price, 'price_in_tether');
|
|
285
|
+
}
|
|
286
|
+
const high = this.safeFloat(ticker, 'high_24h');
|
|
287
|
+
const low = this.safeFloat(ticker, 'low_24h');
|
|
288
|
+
const baseVolume = this.safeFloat(ticker, 'volume_24h');
|
|
289
|
+
return this.safeTicker({
|
|
290
|
+
'symbol': symbol,
|
|
291
|
+
'timestamp': undefined,
|
|
292
|
+
'datetime': undefined,
|
|
293
|
+
'high': high,
|
|
294
|
+
'low': low,
|
|
295
|
+
'bid': undefined,
|
|
296
|
+
'bidVolume': undefined,
|
|
297
|
+
'ask': undefined,
|
|
298
|
+
'askVolume': undefined,
|
|
299
|
+
'vwap': undefined,
|
|
300
|
+
'open': undefined,
|
|
301
|
+
'close': last,
|
|
302
|
+
'last': last,
|
|
303
|
+
'previousClose': undefined,
|
|
304
|
+
'change': this.safeFloat(ticker, 'change_24h'),
|
|
305
|
+
'percentage': undefined,
|
|
306
|
+
'average': undefined,
|
|
307
|
+
'baseVolume': baseVolume,
|
|
308
|
+
'quoteVolume': undefined,
|
|
309
|
+
'info': ticker,
|
|
310
|
+
}, market);
|
|
311
|
+
}
|
|
312
|
+
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
313
|
+
let url = this.urls['api']['public'] + '/' + path;
|
|
314
|
+
const query = this.omit(params, this.extractParams(path));
|
|
315
|
+
query['limit'] = this.safeString(query, 'limit', '1000');
|
|
316
|
+
// Add query parameters if any remain
|
|
317
|
+
if (Object.keys(query).length) {
|
|
318
|
+
url = url + '?' + this.urlencode(query);
|
|
319
|
+
}
|
|
320
|
+
headers = { 'Content-Type': 'application/json' };
|
|
321
|
+
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
exports["default"] = asretether;
|
package/dist/cjs/src/bit24.js
CHANGED
|
@@ -90,6 +90,7 @@ class bit24 extends bit24$1["default"] {
|
|
|
90
90
|
'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/bit24/64x64.png',
|
|
91
91
|
'api': {
|
|
92
92
|
'public': 'https://rest.bit24.cash',
|
|
93
|
+
'otc': 'https://otc-api.bit24.cash',
|
|
93
94
|
},
|
|
94
95
|
'www': 'https://bit24.cash/',
|
|
95
96
|
'doc': [
|
|
@@ -100,6 +101,7 @@ class bit24 extends bit24$1["default"] {
|
|
|
100
101
|
'public': {
|
|
101
102
|
'get': {
|
|
102
103
|
'pro/capi/v1/markets': 1,
|
|
104
|
+
'api/v1/coins/simple-list': 1,
|
|
103
105
|
},
|
|
104
106
|
},
|
|
105
107
|
},
|
|
@@ -116,6 +118,14 @@ class bit24 extends bit24$1["default"] {
|
|
|
116
118
|
* @returns {object[]} an array of objects representing market data
|
|
117
119
|
*/
|
|
118
120
|
const result = [];
|
|
121
|
+
const OTCresponse = await this.publicGetApiV1CoinsSimpleList();
|
|
122
|
+
const OTCmarkets = this.safeDict(OTCresponse, 'data');
|
|
123
|
+
const OTCmarketList = this.safeList(OTCmarkets, 'results', []);
|
|
124
|
+
for (let i = 0; i < OTCmarketList.length; i++) {
|
|
125
|
+
const marketdata = OTCmarketList[i];
|
|
126
|
+
const market = this.parseOtcMarket(marketdata);
|
|
127
|
+
result.push(market);
|
|
128
|
+
}
|
|
119
129
|
let page = 1;
|
|
120
130
|
const limit = 100; // check Bit24 docs for max allowed per page
|
|
121
131
|
while (true) {
|
|
@@ -136,7 +146,7 @@ class bit24 extends bit24$1["default"] {
|
|
|
136
146
|
}
|
|
137
147
|
page += 1;
|
|
138
148
|
}
|
|
139
|
-
return result;
|
|
149
|
+
return this.removeDuplicateValues(result);
|
|
140
150
|
}
|
|
141
151
|
parseMarket(market) {
|
|
142
152
|
// {
|
|
@@ -241,6 +251,68 @@ class bit24 extends bit24$1["default"] {
|
|
|
241
251
|
'info': market,
|
|
242
252
|
};
|
|
243
253
|
}
|
|
254
|
+
parseOtcMarket(market) {
|
|
255
|
+
// {
|
|
256
|
+
// symbol: "0G",
|
|
257
|
+
// name: "0G"
|
|
258
|
+
// },
|
|
259
|
+
let baseId = this.safeString(market, 'symbol');
|
|
260
|
+
let quoteId = 'IRT'; // assuming quote currency is always IRT for OTC markets
|
|
261
|
+
const base = this.safeCurrencyCode(baseId);
|
|
262
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
263
|
+
baseId = baseId.toLowerCase();
|
|
264
|
+
quoteId = quoteId.toLowerCase();
|
|
265
|
+
const id = baseId + '-' + quoteId;
|
|
266
|
+
return {
|
|
267
|
+
'id': id,
|
|
268
|
+
'symbol': base + '/' + quote,
|
|
269
|
+
'base': base,
|
|
270
|
+
'quote': quote,
|
|
271
|
+
'settle': undefined,
|
|
272
|
+
'baseId': baseId,
|
|
273
|
+
'quoteId': quoteId,
|
|
274
|
+
'settleId': undefined,
|
|
275
|
+
'type': 'otc',
|
|
276
|
+
'spot': false,
|
|
277
|
+
'margin': false,
|
|
278
|
+
'swap': false,
|
|
279
|
+
'future': false,
|
|
280
|
+
'option': false,
|
|
281
|
+
'active': true,
|
|
282
|
+
'contract': false,
|
|
283
|
+
'linear': undefined,
|
|
284
|
+
'inverse': undefined,
|
|
285
|
+
'contractSize': undefined,
|
|
286
|
+
'expiry': undefined,
|
|
287
|
+
'expiryDatetime': undefined,
|
|
288
|
+
'strike': undefined,
|
|
289
|
+
'optionType': undefined,
|
|
290
|
+
'precision': {
|
|
291
|
+
'amount': undefined,
|
|
292
|
+
'price': undefined,
|
|
293
|
+
},
|
|
294
|
+
'limits': {
|
|
295
|
+
'leverage': {
|
|
296
|
+
'min': undefined,
|
|
297
|
+
'max': undefined,
|
|
298
|
+
},
|
|
299
|
+
'amount': {
|
|
300
|
+
'min': undefined,
|
|
301
|
+
'max': undefined,
|
|
302
|
+
},
|
|
303
|
+
'price': {
|
|
304
|
+
'min': undefined,
|
|
305
|
+
'max': undefined,
|
|
306
|
+
},
|
|
307
|
+
'cost': {
|
|
308
|
+
'min': undefined,
|
|
309
|
+
'max': undefined,
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
'created': undefined,
|
|
313
|
+
'info': market,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
244
316
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
245
317
|
/**
|
|
246
318
|
* @method
|
|
@@ -255,9 +327,18 @@ class bit24 extends bit24$1["default"] {
|
|
|
255
327
|
if (symbols !== undefined) {
|
|
256
328
|
symbols = this.marketSymbols(symbols);
|
|
257
329
|
}
|
|
330
|
+
const result = {};
|
|
331
|
+
const Otcresponse = await this.publicGetApiV1CoinsSimpleList(params);
|
|
332
|
+
const Otcdata = this.safeDict(Otcresponse, 'data', {});
|
|
333
|
+
const OtctickerList = this.safeList(Otcdata, 'results', []);
|
|
334
|
+
for (let i = 0; i < OtctickerList.length; i++) {
|
|
335
|
+
const tickerData = OtctickerList[i];
|
|
336
|
+
const ticker = this.parseOtcTicker(tickerData);
|
|
337
|
+
const symbol = ticker['symbol'];
|
|
338
|
+
result[symbol] = ticker;
|
|
339
|
+
}
|
|
258
340
|
let page = 1;
|
|
259
341
|
const limit = 100; // adjust if Bit24 docs show a different default
|
|
260
|
-
const result = {};
|
|
261
342
|
while (true) {
|
|
262
343
|
const response = await this.publicGetProCapiV1Markets(this.extend(params, {
|
|
263
344
|
'page': page,
|
|
@@ -373,11 +454,65 @@ class bit24 extends bit24$1["default"] {
|
|
|
373
454
|
'info': ticker,
|
|
374
455
|
}, market);
|
|
375
456
|
}
|
|
457
|
+
parseOtcTicker(ticker, market = undefined) {
|
|
458
|
+
// {
|
|
459
|
+
// symbol: "0G",
|
|
460
|
+
// name: "0G"
|
|
461
|
+
// },
|
|
462
|
+
const marketType = 'otc';
|
|
463
|
+
let base_symbol = this.safeString(ticker, 'symbol');
|
|
464
|
+
base_symbol = base_symbol.toLowerCase();
|
|
465
|
+
const quote_symbol = 'irt'; // assuming quote currency is always IRT for OTC markets
|
|
466
|
+
const marketId = base_symbol + '-' + quote_symbol;
|
|
467
|
+
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
468
|
+
return this.safeTicker({
|
|
469
|
+
'symbol': symbol,
|
|
470
|
+
'timestamp': undefined,
|
|
471
|
+
'datetime': undefined,
|
|
472
|
+
'high': undefined,
|
|
473
|
+
'low': undefined,
|
|
474
|
+
'bid': undefined,
|
|
475
|
+
'bidVolume': undefined,
|
|
476
|
+
'ask': undefined,
|
|
477
|
+
'askVolume': undefined,
|
|
478
|
+
'vwap': undefined,
|
|
479
|
+
'open': undefined,
|
|
480
|
+
'close': undefined,
|
|
481
|
+
'last': undefined,
|
|
482
|
+
'previousClose': undefined,
|
|
483
|
+
'change': undefined,
|
|
484
|
+
'percentage': undefined,
|
|
485
|
+
'average': undefined,
|
|
486
|
+
'baseVolume': undefined,
|
|
487
|
+
'quoteVolume': undefined,
|
|
488
|
+
'info': ticker,
|
|
489
|
+
}, market);
|
|
490
|
+
}
|
|
491
|
+
async removeDuplicateValues(markets) {
|
|
492
|
+
const uniqueMarkets = [];
|
|
493
|
+
const seenIds = new Set();
|
|
494
|
+
for (let i = 0; i < markets.length; i++) {
|
|
495
|
+
const market = markets[i];
|
|
496
|
+
if (!seenIds.has(market['id'])) {
|
|
497
|
+
seenIds.add(market['id']);
|
|
498
|
+
uniqueMarkets.push(market);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
return uniqueMarkets;
|
|
502
|
+
}
|
|
376
503
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
504
|
+
if (path === 'api/v1/coins/simple-list') {
|
|
505
|
+
api = 'otc';
|
|
506
|
+
}
|
|
377
507
|
const query = this.omit(params, this.extractParams(path));
|
|
378
508
|
let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
|
|
379
509
|
url = url + '?' + this.urlencode(query);
|
|
380
|
-
|
|
510
|
+
if (api === 'otc') {
|
|
511
|
+
headers = { 'Content-Type': 'application/json' };
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
headers = { 'Content-Type': 'application/json', 'X-BIT24-APIKEY': 'bdfa2c8c971445d5a4a95c95a5a2a4c2' };
|
|
515
|
+
}
|
|
381
516
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
382
517
|
}
|
|
383
518
|
}
|