ccxt-ir 4.8.2 → 4.9.3
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 +7 -7
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +4 -1
- package/dist/cjs/src/abstract/bitunix.js +11 -0
- package/dist/cjs/src/arzplus.js +132 -4
- package/dist/cjs/src/bitunix.js +327 -0
- package/dist/cjs/src/xt.js +2 -2
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- package/js/src/abstract/arzplus.d.ts +1 -0
- package/js/src/abstract/bitunix.d.ts +9 -0
- package/js/src/abstract/bitunix.js +11 -0
- package/js/src/arzplus.d.ts +2 -0
- package/js/src/arzplus.js +132 -4
- package/js/src/bitunix.d.ts +21 -0
- package/js/src/bitunix.js +326 -0
- package/js/src/xt.js +2 -2
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ interface Exchange {
|
|
|
4
4
|
publicGetApiV1MarketSymbols(params?: {}): Promise<implicitReturnType>;
|
|
5
5
|
publicGetApiV1MarketTradingviewOhlcv(params?: {}): Promise<implicitReturnType>;
|
|
6
6
|
publicGetApiV1MarketDepth(params?: {}): Promise<implicitReturnType>;
|
|
7
|
+
publicGetApiV1MarketIrtInfo(params?: {}): Promise<implicitReturnType>;
|
|
7
8
|
}
|
|
8
9
|
declare abstract class Exchange extends _Exchange {
|
|
9
10
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { implicitReturnType } from '../base/types.js';
|
|
2
|
+
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
3
|
+
interface Exchange {
|
|
4
|
+
publicGetApiSpotV1CommonCoinPairList(params?: {}): Promise<implicitReturnType>;
|
|
5
|
+
publicGetWebApiV1CommonTickers(params?: {}): Promise<implicitReturnType>;
|
|
6
|
+
}
|
|
7
|
+
declare abstract class Exchange extends _Exchange {
|
|
8
|
+
}
|
|
9
|
+
export default Exchange;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// ----------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
|
4
|
+
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
|
5
|
+
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
|
6
|
+
|
|
7
|
+
// -------------------------------------------------------------------------------
|
|
8
|
+
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
9
|
+
class Exchange extends _Exchange {
|
|
10
|
+
}
|
|
11
|
+
export default Exchange;
|
package/js/src/arzplus.d.ts
CHANGED
|
@@ -9,9 +9,11 @@ export default class arzplus extends Exchange {
|
|
|
9
9
|
describe(): any;
|
|
10
10
|
fetchMarkets(params?: {}): Promise<Market[]>;
|
|
11
11
|
parseMarket(market: any): Market;
|
|
12
|
+
parseOTCMarkets(market: any): any;
|
|
12
13
|
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
13
14
|
fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
14
15
|
parseTicker(ticker: any, market?: Market): Ticker;
|
|
16
|
+
parseOTCTicker(ticker: any, market?: Market): Ticker;
|
|
15
17
|
fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
16
18
|
fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
17
19
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
package/js/src/arzplus.js
CHANGED
|
@@ -105,6 +105,7 @@ export default class arzplus extends Exchange {
|
|
|
105
105
|
'api/v1/market/symbols': 1,
|
|
106
106
|
'api/v1/market/tradingview/ohlcv': 1,
|
|
107
107
|
'api/v1/market/depth': 1,
|
|
108
|
+
'api/v1/market/irt/info': 1,
|
|
108
109
|
},
|
|
109
110
|
},
|
|
110
111
|
},
|
|
@@ -132,11 +133,22 @@ export default class arzplus extends Exchange {
|
|
|
132
133
|
'enable': 'true',
|
|
133
134
|
};
|
|
134
135
|
const response = await this.publicGetApiV1MarketSymbols(request);
|
|
136
|
+
const otcMarkets = await this.publicGetApiV1MarketIrtInfo(request);
|
|
135
137
|
const result = [];
|
|
136
138
|
for (let i = 0; i < response.length; i++) {
|
|
137
139
|
const market = this.parseMarket(response[i]);
|
|
138
140
|
result.push(market);
|
|
139
141
|
}
|
|
142
|
+
for (let i = 0; i < otcMarkets.length; i++) {
|
|
143
|
+
const marketdata = otcMarkets[i];
|
|
144
|
+
marketdata['quote'] = 'IRT';
|
|
145
|
+
marketdata['id'] = 'OTC_' + marketdata['symbol'] + marketdata['quote'];
|
|
146
|
+
const parsedMarket = this.parseOTCMarkets(marketdata);
|
|
147
|
+
result.push(parsedMarket);
|
|
148
|
+
}
|
|
149
|
+
if (params['type']) {
|
|
150
|
+
return this.filterByArray(result, 'type', params['type'], false);
|
|
151
|
+
}
|
|
140
152
|
return result;
|
|
141
153
|
}
|
|
142
154
|
parseMarket(market) {
|
|
@@ -235,6 +247,70 @@ export default class arzplus extends Exchange {
|
|
|
235
247
|
'info': market,
|
|
236
248
|
};
|
|
237
249
|
}
|
|
250
|
+
parseOTCMarkets(market) {
|
|
251
|
+
// {
|
|
252
|
+
// symbol: "BTC",
|
|
253
|
+
// ask: "13877900000",
|
|
254
|
+
// bid: "13860999995",
|
|
255
|
+
// name: "bitcoin"
|
|
256
|
+
// },
|
|
257
|
+
const baseAsset = this.safeString(market, 'symbol');
|
|
258
|
+
const quoteAsset = this.safeString(market, 'quote');
|
|
259
|
+
const baseId = baseAsset;
|
|
260
|
+
const quoteId = quoteAsset;
|
|
261
|
+
const base = this.safeCurrencyCode(baseId);
|
|
262
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
263
|
+
const id = this.safeString(market, 'id');
|
|
264
|
+
return {
|
|
265
|
+
'id': id,
|
|
266
|
+
'symbol': base + '/' + quote,
|
|
267
|
+
'base': base,
|
|
268
|
+
'quote': quote,
|
|
269
|
+
'settle': undefined,
|
|
270
|
+
'baseId': baseId,
|
|
271
|
+
'quoteId': quoteId,
|
|
272
|
+
'settleId': undefined,
|
|
273
|
+
'type': 'otc',
|
|
274
|
+
'spot': true,
|
|
275
|
+
'margin': false,
|
|
276
|
+
'swap': false,
|
|
277
|
+
'future': false,
|
|
278
|
+
'option': false,
|
|
279
|
+
'active': true,
|
|
280
|
+
'contract': false,
|
|
281
|
+
'linear': undefined,
|
|
282
|
+
'inverse': undefined,
|
|
283
|
+
'contractSize': undefined,
|
|
284
|
+
'expiry': undefined,
|
|
285
|
+
'expiryDatetime': undefined,
|
|
286
|
+
'strike': undefined,
|
|
287
|
+
'optionType': undefined,
|
|
288
|
+
'precision': {
|
|
289
|
+
'amount': undefined,
|
|
290
|
+
'price': undefined,
|
|
291
|
+
},
|
|
292
|
+
'limits': {
|
|
293
|
+
'leverage': {
|
|
294
|
+
'min': undefined,
|
|
295
|
+
'max': undefined,
|
|
296
|
+
},
|
|
297
|
+
'amount': {
|
|
298
|
+
'min': undefined,
|
|
299
|
+
'max': undefined,
|
|
300
|
+
},
|
|
301
|
+
'price': {
|
|
302
|
+
'min': undefined,
|
|
303
|
+
'max': undefined,
|
|
304
|
+
},
|
|
305
|
+
'cost': {
|
|
306
|
+
'min': undefined,
|
|
307
|
+
'max': undefined,
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
'created': undefined,
|
|
311
|
+
'info': market,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
238
314
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
239
315
|
/**
|
|
240
316
|
* @method
|
|
@@ -249,8 +325,20 @@ export default class arzplus extends Exchange {
|
|
|
249
325
|
if (symbols !== undefined) {
|
|
250
326
|
symbols = this.marketSymbols(symbols);
|
|
251
327
|
}
|
|
252
|
-
const response = await this.publicGetApiV1MarketSymbols(params);
|
|
253
328
|
const result = {};
|
|
329
|
+
if (params['type'] === 'otc') {
|
|
330
|
+
const otcMarkets = await this.publicGetApiV1MarketIrtInfo(params);
|
|
331
|
+
for (let i = 0; i < otcMarkets.length; i++) {
|
|
332
|
+
const marketdata = otcMarkets[i];
|
|
333
|
+
marketdata['quote'] = 'IRT';
|
|
334
|
+
marketdata['id'] = 'OTC_' + marketdata['symbol'] + marketdata['quote'];
|
|
335
|
+
const parsedMarket = this.parseOTCTicker(marketdata);
|
|
336
|
+
const symbol = parsedMarket['symbol'];
|
|
337
|
+
result[symbol] = parsedMarket;
|
|
338
|
+
}
|
|
339
|
+
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
340
|
+
}
|
|
341
|
+
const response = await this.publicGetApiV1MarketSymbols(params);
|
|
254
342
|
for (let i = 0; i < response.length; i++) {
|
|
255
343
|
const request = {
|
|
256
344
|
'symbol': response[i]['name'],
|
|
@@ -350,6 +438,44 @@ export default class arzplus extends Exchange {
|
|
|
350
438
|
'info': ticker,
|
|
351
439
|
}, market);
|
|
352
440
|
}
|
|
441
|
+
parseOTCTicker(ticker, market = undefined) {
|
|
442
|
+
// {
|
|
443
|
+
// id: "BTCUSDT",
|
|
444
|
+
// symbol: "BTC",
|
|
445
|
+
// ask: "13877900000",
|
|
446
|
+
// bid: "13860999995",
|
|
447
|
+
// name: "bitcoin"
|
|
448
|
+
// quote: "IRT"
|
|
449
|
+
// }
|
|
450
|
+
const marketType = 'otc';
|
|
451
|
+
const marketId = this.safeString(ticker, 'id');
|
|
452
|
+
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
453
|
+
const bid = this.safeFloat(ticker, 'bid', 0);
|
|
454
|
+
const ask = this.safeFloat(ticker, 'ask', 0);
|
|
455
|
+
const last = this.safeFloat(ticker, 'ask', 0);
|
|
456
|
+
return this.safeTicker({
|
|
457
|
+
'symbol': symbol,
|
|
458
|
+
'timestamp': undefined,
|
|
459
|
+
'datetime': undefined,
|
|
460
|
+
'high': undefined,
|
|
461
|
+
'low': undefined,
|
|
462
|
+
'bid': bid,
|
|
463
|
+
'bidVolume': undefined,
|
|
464
|
+
'ask': ask,
|
|
465
|
+
'askVolume': undefined,
|
|
466
|
+
'vwap': undefined,
|
|
467
|
+
'open': last,
|
|
468
|
+
'close': last,
|
|
469
|
+
'last': last,
|
|
470
|
+
'previousClose': undefined,
|
|
471
|
+
'change': undefined,
|
|
472
|
+
'percentage': undefined,
|
|
473
|
+
'average': undefined,
|
|
474
|
+
'baseVolume': undefined,
|
|
475
|
+
'quoteVolume': undefined,
|
|
476
|
+
'info': ticker,
|
|
477
|
+
}, market);
|
|
478
|
+
}
|
|
353
479
|
async fetchOHLCV(symbol, timeframe = '1h', since = undefined, limit = undefined, params = {}) {
|
|
354
480
|
/**
|
|
355
481
|
* @method
|
|
@@ -421,14 +547,16 @@ export default class arzplus extends Exchange {
|
|
|
421
547
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
422
548
|
const query = this.omit(params, this.extractParams(path));
|
|
423
549
|
let url = this.urls['api']['public'] + '/' + path;
|
|
424
|
-
|
|
550
|
+
const symbol = this.safeString(params, 'symbol');
|
|
551
|
+
const stats = this.safeValue(params, 'stats');
|
|
552
|
+
if (stats !== undefined) {
|
|
425
553
|
url = url + '?' + this.urlencode(query);
|
|
426
554
|
}
|
|
427
555
|
if (path === 'api/v1/market/tradingview/ohlcv') {
|
|
428
556
|
url = url + '?' + this.urlencode(query);
|
|
429
557
|
}
|
|
430
|
-
else if (
|
|
431
|
-
url = url + '/' +
|
|
558
|
+
else if (symbol !== undefined) {
|
|
559
|
+
url = url + '/' + symbol;
|
|
432
560
|
}
|
|
433
561
|
headers = { 'Content-Type': 'application/json' };
|
|
434
562
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Exchange from './abstract/bitunix.js';
|
|
2
|
+
import { Market, Strings, Ticker, Tickers } from './base/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @class bitunix
|
|
5
|
+
* @augments Exchange
|
|
6
|
+
* @description Set rateLimit to 1000 if fully verified
|
|
7
|
+
*/
|
|
8
|
+
export default class bitunix extends Exchange {
|
|
9
|
+
describe(): any;
|
|
10
|
+
fetchMarkets(params?: {}): Promise<Market[]>;
|
|
11
|
+
parseMarket(market: any): Market;
|
|
12
|
+
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
13
|
+
fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
14
|
+
parseTicker(ticker: any, market?: Market): Ticker;
|
|
15
|
+
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
16
|
+
url: string;
|
|
17
|
+
method: string;
|
|
18
|
+
body: any;
|
|
19
|
+
headers: any;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
// ----------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
|
4
|
+
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
|
5
|
+
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
|
6
|
+
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
import Exchange from './abstract/bitunix.js';
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
/**
|
|
11
|
+
* @class bitunix
|
|
12
|
+
* @augments Exchange
|
|
13
|
+
* @description Set rateLimit to 1000 if fully verified
|
|
14
|
+
*/
|
|
15
|
+
export default class bitunix extends Exchange {
|
|
16
|
+
describe() {
|
|
17
|
+
return this.deepExtend(super.describe(), {
|
|
18
|
+
'id': 'bitunix',
|
|
19
|
+
'name': 'bitunix',
|
|
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': true,
|
|
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': true,
|
|
68
|
+
'fetchOpenInterestHistory': false,
|
|
69
|
+
'fetchOpenOrders': false,
|
|
70
|
+
'fetchOrder': false,
|
|
71
|
+
'fetchOrderBook': true,
|
|
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/bitunix/64x64.png',
|
|
91
|
+
'api': {
|
|
92
|
+
'market': 'https://openapi.bitunix.com/',
|
|
93
|
+
'tickers': 'https://api.bitunix.com/',
|
|
94
|
+
},
|
|
95
|
+
'www': 'https://www.bitunix.com/',
|
|
96
|
+
'doc': [
|
|
97
|
+
'https://openapidoc.bitunix.com/',
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
'timeframes': {
|
|
101
|
+
'1m': '1',
|
|
102
|
+
'5m': '5',
|
|
103
|
+
'15m': '15',
|
|
104
|
+
'30m': '30',
|
|
105
|
+
'1h': '60',
|
|
106
|
+
'3h': '180',
|
|
107
|
+
'4h': '240',
|
|
108
|
+
'12h': '720',
|
|
109
|
+
'1d': '1D',
|
|
110
|
+
'1w': '1W',
|
|
111
|
+
},
|
|
112
|
+
'api': {
|
|
113
|
+
'public': {
|
|
114
|
+
'get': {
|
|
115
|
+
'api/spot/v1/common/coin_pair/list/': 1,
|
|
116
|
+
'web/api/v1/common/tickers/': 1,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
'fees': {
|
|
121
|
+
'trading': {
|
|
122
|
+
'tierBased': false,
|
|
123
|
+
'percentage': true,
|
|
124
|
+
'maker': this.parseNumber('0.001'),
|
|
125
|
+
'taker': this.parseNumber('0.001'),
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
async fetchMarkets(params = {}) {
|
|
131
|
+
/**
|
|
132
|
+
* @method
|
|
133
|
+
* @name bitunix#fetchMarkets
|
|
134
|
+
* @description retrieves data on all markets for bitunix
|
|
135
|
+
* @see https://api-docs.bitunix.ir/#be8d9c51a2
|
|
136
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
137
|
+
* @returns {object[]} an array of objects representing market data
|
|
138
|
+
*/
|
|
139
|
+
const response = await this.publicGetApiSpotV1CommonCoinPairList(params);
|
|
140
|
+
const markets = this.safeList(response, 'data');
|
|
141
|
+
const result = [];
|
|
142
|
+
for (let i = 0; i < markets.length; i++) {
|
|
143
|
+
const market = this.parseMarket(markets[i]);
|
|
144
|
+
result.push(market);
|
|
145
|
+
}
|
|
146
|
+
return result;
|
|
147
|
+
}
|
|
148
|
+
parseMarket(market) {
|
|
149
|
+
// {
|
|
150
|
+
// id: 1,
|
|
151
|
+
// symbol: "btcusdt",
|
|
152
|
+
// base: "BTC",
|
|
153
|
+
// baseIcon: "https://img.bitunix.com/config/kv/228408.png",
|
|
154
|
+
// quote: "USDT",
|
|
155
|
+
// quoteIcon: "https://img.bitunix.com/config/coin/USDT.png",
|
|
156
|
+
// basePrecision: 5,
|
|
157
|
+
// quotePrecision: 2,
|
|
158
|
+
// minPrice: "10.0000000000000000",
|
|
159
|
+
// minVolume: "0.0000500000000000",
|
|
160
|
+
// maxAmount: "500000.0000000000000000",
|
|
161
|
+
// minAmount: "0.0000000000000000",
|
|
162
|
+
// maxLimitOrderAmount: "1500000.0000000000000000",
|
|
163
|
+
// maxMarketOrderAmount: "2000000.0000000000000000",
|
|
164
|
+
// maxSlippage: "0.0500",
|
|
165
|
+
// premiumFactor: "0.0500",
|
|
166
|
+
// minBuyPriceOffset: "-0.8000",
|
|
167
|
+
// maxSellPriceOffset: "50.0000",
|
|
168
|
+
// isOpen: 1,
|
|
169
|
+
// isHot: 1,
|
|
170
|
+
// isRecommend: 1,
|
|
171
|
+
// isShow: 1,
|
|
172
|
+
// tradeArea: "USDT",
|
|
173
|
+
// sort: 1,
|
|
174
|
+
// openTime: null,
|
|
175
|
+
// ctime: "2023-05-12T18:03:08Z",
|
|
176
|
+
// precisions: [
|
|
177
|
+
// "0.0100000000000000",
|
|
178
|
+
// "0.1000000000000000",
|
|
179
|
+
// "1.0000000000000000",
|
|
180
|
+
// "10.0000000000000000",
|
|
181
|
+
// "100.0000000000000000"
|
|
182
|
+
// ]
|
|
183
|
+
// }
|
|
184
|
+
const baseId = this.safeString(market, 'base');
|
|
185
|
+
const quoteId = this.safeString(market, 'quote');
|
|
186
|
+
const base = this.safeCurrencyCode(baseId);
|
|
187
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
188
|
+
const id = (base + quote);
|
|
189
|
+
return {
|
|
190
|
+
'id': id,
|
|
191
|
+
'symbol': base + '/' + quote,
|
|
192
|
+
'base': base,
|
|
193
|
+
'quote': quote,
|
|
194
|
+
'settle': undefined,
|
|
195
|
+
'baseId': baseId,
|
|
196
|
+
'quoteId': quoteId,
|
|
197
|
+
'settleId': undefined,
|
|
198
|
+
'type': 'spot',
|
|
199
|
+
'spot': true,
|
|
200
|
+
'margin': false,
|
|
201
|
+
'swap': false,
|
|
202
|
+
'future': false,
|
|
203
|
+
'option': false,
|
|
204
|
+
'active': true,
|
|
205
|
+
'contract': false,
|
|
206
|
+
'linear': undefined,
|
|
207
|
+
'inverse': undefined,
|
|
208
|
+
'contractSize': undefined,
|
|
209
|
+
'expiry': undefined,
|
|
210
|
+
'expiryDatetime': undefined,
|
|
211
|
+
'strike': undefined,
|
|
212
|
+
'optionType': undefined,
|
|
213
|
+
'precision': {
|
|
214
|
+
'amount': undefined,
|
|
215
|
+
'price': undefined,
|
|
216
|
+
},
|
|
217
|
+
'limits': {
|
|
218
|
+
'leverage': {
|
|
219
|
+
'min': undefined,
|
|
220
|
+
'max': undefined,
|
|
221
|
+
},
|
|
222
|
+
'amount': {
|
|
223
|
+
'min': undefined,
|
|
224
|
+
'max': undefined,
|
|
225
|
+
},
|
|
226
|
+
'price': {
|
|
227
|
+
'min': undefined,
|
|
228
|
+
'max': undefined,
|
|
229
|
+
},
|
|
230
|
+
'cost': {
|
|
231
|
+
'min': undefined,
|
|
232
|
+
'max': undefined,
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
'created': undefined,
|
|
236
|
+
'info': market,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
async fetchTickers(symbols = undefined, params = {}) {
|
|
240
|
+
/**
|
|
241
|
+
* @method
|
|
242
|
+
* @name bitunix#fetchTickers
|
|
243
|
+
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
244
|
+
* @see https://api-docs.bitunix.ir/#be8d9c51a2
|
|
245
|
+
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
246
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
247
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
248
|
+
*/
|
|
249
|
+
await this.loadMarkets();
|
|
250
|
+
if (symbols !== undefined) {
|
|
251
|
+
symbols = this.marketSymbols(symbols);
|
|
252
|
+
}
|
|
253
|
+
const response = await this.publicGetWebApiV1CommonTickers();
|
|
254
|
+
const markets = this.safeList(response, 'data');
|
|
255
|
+
const result = {};
|
|
256
|
+
for (let i = 0; i < markets.length; i++) {
|
|
257
|
+
const ticker = this.parseTicker(markets[i]);
|
|
258
|
+
const symbol = ticker['symbol'];
|
|
259
|
+
result[symbol] = ticker;
|
|
260
|
+
}
|
|
261
|
+
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
262
|
+
}
|
|
263
|
+
async fetchTicker(symbol, params = {}) {
|
|
264
|
+
/**
|
|
265
|
+
* @method
|
|
266
|
+
* @name bitunix#fetchTicker
|
|
267
|
+
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
268
|
+
* @see https://api-docs.bitunix.ir/#be8d9c51a2
|
|
269
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
270
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
271
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
272
|
+
*/
|
|
273
|
+
const ticker = await this.fetchTickers([symbol]);
|
|
274
|
+
return ticker[symbol];
|
|
275
|
+
}
|
|
276
|
+
parseTicker(ticker, market = undefined) {
|
|
277
|
+
// {
|
|
278
|
+
// symbol: "BTCUSDT",
|
|
279
|
+
// base: "BTC",
|
|
280
|
+
// quote: "USDT",
|
|
281
|
+
// close: "112832.34",
|
|
282
|
+
// rose24h: "0.2276416293",
|
|
283
|
+
// volume: "228310106.7861019"
|
|
284
|
+
// },
|
|
285
|
+
const marketType = 'spot';
|
|
286
|
+
const marketId = this.safeString(ticker, 'symbol');
|
|
287
|
+
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
288
|
+
const last = this.safeFloat(ticker, 'close', 0);
|
|
289
|
+
const change = this.safeFloat(ticker, 'rose24h', 0);
|
|
290
|
+
const quoteVolume = this.safeFloat(ticker, 'volume', 0);
|
|
291
|
+
let baseVolume = 0;
|
|
292
|
+
if (last !== 0) {
|
|
293
|
+
baseVolume = quoteVolume / last;
|
|
294
|
+
}
|
|
295
|
+
return this.safeTicker({
|
|
296
|
+
'symbol': symbol,
|
|
297
|
+
'timestamp': undefined,
|
|
298
|
+
'datetime': undefined,
|
|
299
|
+
'high': undefined,
|
|
300
|
+
'low': undefined,
|
|
301
|
+
'bid': undefined,
|
|
302
|
+
'bidVolume': undefined,
|
|
303
|
+
'ask': undefined,
|
|
304
|
+
'askVolume': undefined,
|
|
305
|
+
'vwap': undefined,
|
|
306
|
+
'open': undefined,
|
|
307
|
+
'close': last,
|
|
308
|
+
'last': last,
|
|
309
|
+
'previousClose': undefined,
|
|
310
|
+
'change': change,
|
|
311
|
+
'percentage': change,
|
|
312
|
+
'average': undefined,
|
|
313
|
+
'baseVolume': baseVolume,
|
|
314
|
+
'quoteVolume': quoteVolume,
|
|
315
|
+
'info': ticker,
|
|
316
|
+
}, market);
|
|
317
|
+
}
|
|
318
|
+
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
319
|
+
let url = this.urls['api']['market'] + '/' + path;
|
|
320
|
+
if (path === 'web/api/v1/common/tickers/') {
|
|
321
|
+
url = this.urls['api']['tickers'] + '/' + path;
|
|
322
|
+
}
|
|
323
|
+
headers = { 'Content-Type': 'application/json' };
|
|
324
|
+
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
325
|
+
}
|
|
326
|
+
}
|
package/js/src/xt.js
CHANGED
|
@@ -1635,7 +1635,7 @@ export default class xt extends Exchange {
|
|
|
1635
1635
|
response = await this.publicInverseGetFutureMarketV1PublicQAggTicker(this.extend(request, params));
|
|
1636
1636
|
}
|
|
1637
1637
|
else {
|
|
1638
|
-
response = await this.
|
|
1638
|
+
response = await this.publicSpotGetTicker(this.extend(request, params));
|
|
1639
1639
|
}
|
|
1640
1640
|
//
|
|
1641
1641
|
// spot
|
|
@@ -1898,7 +1898,7 @@ export default class xt extends Exchange {
|
|
|
1898
1898
|
'change': this.safeNumber(ticker, 'cv'),
|
|
1899
1899
|
'percentage': this.parseNumber(percentage),
|
|
1900
1900
|
'average': undefined,
|
|
1901
|
-
'baseVolume':
|
|
1901
|
+
'baseVolume': this.safeNumber2(ticker, 'a', 'q'),
|
|
1902
1902
|
'quoteVolume': this.safeNumber2(ticker, 'a', 'v'),
|
|
1903
1903
|
'info': ticker,
|
|
1904
1904
|
}, market);
|
package/package.json
CHANGED