ccxt-ir 4.9.16 → 4.9.22

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.
Files changed (36) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/abstract/bitunix.js +1 -1
  5. package/dist/cjs/src/bitunix.js +317 -317
  6. package/dist/cjs/src/kcex.js +4 -4
  7. package/dist/cjs/src/ompfinex.js +501 -498
  8. package/dist/cjs/src/sarmayex.js +1 -1
  9. package/dist/cjs/src/toobit.js +2 -2
  10. package/dist/cjs/src/xt.js +5171 -5171
  11. package/js/ccxt.d.ts +1 -1
  12. package/js/ccxt.js +1 -1
  13. package/js/src/abstract/bitunix.d.ts +9 -9
  14. package/js/src/abstract/bitunix.js +5 -5
  15. package/js/src/abstract/kcex.d.ts +10 -10
  16. package/js/src/base/Exchange.d.ts +2 -2
  17. package/js/src/bitunix.d.ts +21 -21
  18. package/js/src/bitunix.js +320 -320
  19. package/js/src/coinbaseexchange.d.ts +1 -1
  20. package/js/src/kcex.d.ts +21 -21
  21. package/js/src/kcex.js +4 -4
  22. package/js/src/ompfinex.js +504 -501
  23. package/js/src/protobuf/mexc/compiled.d.cts +6 -0
  24. package/js/src/sarmayex.js +1 -1
  25. package/js/src/static_dependencies/fflake/browser.d.ts +5 -5
  26. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  27. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.d.ts +204 -204
  28. package/js/src/static_dependencies/qs/formats.d.cts +6 -0
  29. package/js/src/static_dependencies/qs/index.d.cts +6 -0
  30. package/js/src/static_dependencies/qs/parse.d.cts +6 -0
  31. package/js/src/static_dependencies/qs/stringify.d.cts +6 -0
  32. package/js/src/static_dependencies/qs/utils.d.cts +6 -0
  33. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
  34. package/js/src/toobit.js +2 -2
  35. package/js/src/xt.js +5178 -5178
  36. package/package.json +1 -1
@@ -5,323 +5,323 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var bitunix$1 = require('./abstract/bitunix.js');
6
6
 
7
7
  // ----------------------------------------------------------------------------
8
- // ---------------------------------------------------------------------------
9
- /**
10
- * @class bitunix
11
- * @augments Exchange
12
- * @description Set rateLimit to 1000 if fully verified
13
- */
14
- class bitunix extends bitunix$1["default"] {
15
- describe() {
16
- return this.deepExtend(super.describe(), {
17
- 'id': 'bitunix',
18
- 'name': 'bitunix',
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': true,
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': true,
67
- 'fetchOpenInterestHistory': false,
68
- 'fetchOpenOrders': false,
69
- 'fetchOrder': false,
70
- 'fetchOrderBook': true,
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/bitunix/64x64.png',
90
- 'api': {
91
- 'market': 'https://openapi.bitunix.com/',
92
- 'tickers': 'https://api.bitunix.com/',
93
- },
94
- 'www': 'https://www.bitunix.com/',
95
- 'doc': [
96
- 'https://openapidoc.bitunix.com/',
97
- ],
98
- },
99
- 'timeframes': {
100
- '1m': '1',
101
- '5m': '5',
102
- '15m': '15',
103
- '30m': '30',
104
- '1h': '60',
105
- '3h': '180',
106
- '4h': '240',
107
- '12h': '720',
108
- '1d': '1D',
109
- '1w': '1W',
110
- },
111
- 'api': {
112
- 'public': {
113
- 'get': {
114
- 'api/spot/v1/common/coin_pair/list/': 1,
115
- 'web/api/v1/common/tickers/': 1,
116
- },
117
- },
118
- },
119
- 'fees': {
120
- 'trading': {
121
- 'tierBased': false,
122
- 'percentage': true,
123
- 'maker': this.parseNumber('0.001'),
124
- 'taker': this.parseNumber('0.001'),
125
- },
126
- },
127
- });
128
- }
129
- async fetchMarkets(params = {}) {
130
- /**
131
- * @method
132
- * @name bitunix#fetchMarkets
133
- * @description retrieves data on all markets for bitunix
134
- * @see https://api-docs.bitunix.ir/#be8d9c51a2
135
- * @param {object} [params] extra parameters specific to the exchange API endpoint
136
- * @returns {object[]} an array of objects representing market data
137
- */
138
- const response = await this.publicGetApiSpotV1CommonCoinPairList(params);
139
- const markets = this.safeList(response, 'data');
140
- const result = [];
141
- for (let i = 0; i < markets.length; i++) {
142
- const market = this.parseMarket(markets[i]);
143
- result.push(market);
144
- }
145
- return result;
146
- }
147
- parseMarket(market) {
148
- // {
149
- // id: 1,
150
- // symbol: "btcusdt",
151
- // base: "BTC",
152
- // baseIcon: "https://img.bitunix.com/config/kv/228408.png",
153
- // quote: "USDT",
154
- // quoteIcon: "https://img.bitunix.com/config/coin/USDT.png",
155
- // basePrecision: 5,
156
- // quotePrecision: 2,
157
- // minPrice: "10.0000000000000000",
158
- // minVolume: "0.0000500000000000",
159
- // maxAmount: "500000.0000000000000000",
160
- // minAmount: "0.0000000000000000",
161
- // maxLimitOrderAmount: "1500000.0000000000000000",
162
- // maxMarketOrderAmount: "2000000.0000000000000000",
163
- // maxSlippage: "0.0500",
164
- // premiumFactor: "0.0500",
165
- // minBuyPriceOffset: "-0.8000",
166
- // maxSellPriceOffset: "50.0000",
167
- // isOpen: 1,
168
- // isHot: 1,
169
- // isRecommend: 1,
170
- // isShow: 1,
171
- // tradeArea: "USDT",
172
- // sort: 1,
173
- // openTime: null,
174
- // ctime: "2023-05-12T18:03:08Z",
175
- // precisions: [
176
- // "0.0100000000000000",
177
- // "0.1000000000000000",
178
- // "1.0000000000000000",
179
- // "10.0000000000000000",
180
- // "100.0000000000000000"
181
- // ]
182
- // }
183
- const baseId = this.safeString(market, 'base');
184
- const quoteId = this.safeString(market, 'quote');
185
- const base = this.safeCurrencyCode(baseId);
186
- const quote = this.safeCurrencyCode(quoteId);
187
- const id = (base + quote);
188
- return {
189
- 'id': id,
190
- 'symbol': base + '/' + quote,
191
- 'base': base,
192
- 'quote': quote,
193
- 'settle': undefined,
194
- 'baseId': baseId,
195
- 'quoteId': quoteId,
196
- 'settleId': undefined,
197
- 'type': 'spot',
198
- 'spot': true,
199
- 'margin': false,
200
- 'swap': false,
201
- 'future': false,
202
- 'option': false,
203
- 'active': true,
204
- 'contract': false,
205
- 'linear': undefined,
206
- 'inverse': undefined,
207
- 'contractSize': undefined,
208
- 'expiry': undefined,
209
- 'expiryDatetime': undefined,
210
- 'strike': undefined,
211
- 'optionType': undefined,
212
- 'precision': {
213
- 'amount': undefined,
214
- 'price': undefined,
215
- },
216
- 'limits': {
217
- 'leverage': {
218
- 'min': undefined,
219
- 'max': undefined,
220
- },
221
- 'amount': {
222
- 'min': undefined,
223
- 'max': undefined,
224
- },
225
- 'price': {
226
- 'min': undefined,
227
- 'max': undefined,
228
- },
229
- 'cost': {
230
- 'min': undefined,
231
- 'max': undefined,
232
- },
233
- },
234
- 'created': undefined,
235
- 'info': market,
236
- };
237
- }
238
- async fetchTickers(symbols = undefined, params = {}) {
239
- /**
240
- * @method
241
- * @name bitunix#fetchTickers
242
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
243
- * @see https://api-docs.bitunix.ir/#be8d9c51a2
244
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
245
- * @param {object} [params] extra parameters specific to the exchange API endpoint
246
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
247
- */
248
- await this.loadMarkets();
249
- if (symbols !== undefined) {
250
- symbols = this.marketSymbols(symbols);
251
- }
252
- const response = await this.publicGetWebApiV1CommonTickers();
253
- const markets = this.safeList(response, 'data');
254
- const result = {};
255
- for (let i = 0; i < markets.length; i++) {
256
- const ticker = this.parseTicker(markets[i]);
257
- const symbol = ticker['symbol'];
258
- result[symbol] = ticker;
259
- }
260
- return this.filterByArrayTickers(result, 'symbol', symbols);
261
- }
262
- async fetchTicker(symbol, params = {}) {
263
- /**
264
- * @method
265
- * @name bitunix#fetchTicker
266
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
267
- * @see https://api-docs.bitunix.ir/#be8d9c51a2
268
- * @param {string} symbol unified symbol of the market to fetch the ticker for
269
- * @param {object} [params] extra parameters specific to the exchange API endpoint
270
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
271
- */
272
- const ticker = await this.fetchTickers([symbol]);
273
- return ticker[symbol];
274
- }
275
- parseTicker(ticker, market = undefined) {
276
- // {
277
- // symbol: "BTCUSDT",
278
- // base: "BTC",
279
- // quote: "USDT",
280
- // close: "112832.34",
281
- // rose24h: "0.2276416293",
282
- // volume: "228310106.7861019"
283
- // },
284
- const marketType = 'spot';
285
- const marketId = this.safeString(ticker, 'symbol');
286
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
287
- const last = this.safeFloat(ticker, 'close', 0);
288
- const change = this.safeFloat(ticker, 'rose24h', 0);
289
- const quoteVolume = this.safeFloat(ticker, 'volume', 0);
290
- let baseVolume = 0;
291
- if (last !== 0) {
292
- baseVolume = quoteVolume / last;
293
- }
294
- return this.safeTicker({
295
- 'symbol': symbol,
296
- 'timestamp': undefined,
297
- 'datetime': undefined,
298
- 'high': undefined,
299
- 'low': undefined,
300
- 'bid': undefined,
301
- 'bidVolume': undefined,
302
- 'ask': undefined,
303
- 'askVolume': undefined,
304
- 'vwap': undefined,
305
- 'open': undefined,
306
- 'close': last,
307
- 'last': last,
308
- 'previousClose': undefined,
309
- 'change': change,
310
- 'percentage': change,
311
- 'average': undefined,
312
- 'baseVolume': baseVolume,
313
- 'quoteVolume': quoteVolume,
314
- 'info': ticker,
315
- }, market);
316
- }
317
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
318
- let url = this.urls['api']['market'] + '/' + path;
319
- if (path === 'web/api/v1/common/tickers/') {
320
- url = this.urls['api']['tickers'] + '/' + path;
321
- }
322
- headers = { 'Content-Type': 'application/json' };
323
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
324
- }
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class bitunix
11
+ * @augments Exchange
12
+ * @description Set rateLimit to 1000 if fully verified
13
+ */
14
+ class bitunix extends bitunix$1["default"] {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'bitunix',
18
+ 'name': 'bitunix',
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': true,
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': true,
67
+ 'fetchOpenInterestHistory': false,
68
+ 'fetchOpenOrders': false,
69
+ 'fetchOrder': false,
70
+ 'fetchOrderBook': true,
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/bitunix/64x64.png',
90
+ 'api': {
91
+ 'market': 'https://openapi.bitunix.com/',
92
+ 'tickers': 'https://api.bitunix.com/',
93
+ },
94
+ 'www': 'https://www.bitunix.com/',
95
+ 'doc': [
96
+ 'https://openapidoc.bitunix.com/',
97
+ ],
98
+ },
99
+ 'timeframes': {
100
+ '1m': '1',
101
+ '5m': '5',
102
+ '15m': '15',
103
+ '30m': '30',
104
+ '1h': '60',
105
+ '3h': '180',
106
+ '4h': '240',
107
+ '12h': '720',
108
+ '1d': '1D',
109
+ '1w': '1W',
110
+ },
111
+ 'api': {
112
+ 'public': {
113
+ 'get': {
114
+ 'api/spot/v1/common/coin_pair/list/': 1,
115
+ 'web/api/v1/common/tickers/': 1,
116
+ },
117
+ },
118
+ },
119
+ 'fees': {
120
+ 'trading': {
121
+ 'tierBased': false,
122
+ 'percentage': true,
123
+ 'maker': this.parseNumber('0.001'),
124
+ 'taker': this.parseNumber('0.001'),
125
+ },
126
+ },
127
+ });
128
+ }
129
+ async fetchMarkets(params = {}) {
130
+ /**
131
+ * @method
132
+ * @name bitunix#fetchMarkets
133
+ * @description retrieves data on all markets for bitunix
134
+ * @see https://api-docs.bitunix.ir/#be8d9c51a2
135
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
136
+ * @returns {object[]} an array of objects representing market data
137
+ */
138
+ const response = await this.publicGetApiSpotV1CommonCoinPairList(params);
139
+ const markets = this.safeList(response, 'data');
140
+ const result = [];
141
+ for (let i = 0; i < markets.length; i++) {
142
+ const market = this.parseMarket(markets[i]);
143
+ result.push(market);
144
+ }
145
+ return result;
146
+ }
147
+ parseMarket(market) {
148
+ // {
149
+ // id: 1,
150
+ // symbol: "btcusdt",
151
+ // base: "BTC",
152
+ // baseIcon: "https://img.bitunix.com/config/kv/228408.png",
153
+ // quote: "USDT",
154
+ // quoteIcon: "https://img.bitunix.com/config/coin/USDT.png",
155
+ // basePrecision: 5,
156
+ // quotePrecision: 2,
157
+ // minPrice: "10.0000000000000000",
158
+ // minVolume: "0.0000500000000000",
159
+ // maxAmount: "500000.0000000000000000",
160
+ // minAmount: "0.0000000000000000",
161
+ // maxLimitOrderAmount: "1500000.0000000000000000",
162
+ // maxMarketOrderAmount: "2000000.0000000000000000",
163
+ // maxSlippage: "0.0500",
164
+ // premiumFactor: "0.0500",
165
+ // minBuyPriceOffset: "-0.8000",
166
+ // maxSellPriceOffset: "50.0000",
167
+ // isOpen: 1,
168
+ // isHot: 1,
169
+ // isRecommend: 1,
170
+ // isShow: 1,
171
+ // tradeArea: "USDT",
172
+ // sort: 1,
173
+ // openTime: null,
174
+ // ctime: "2023-05-12T18:03:08Z",
175
+ // precisions: [
176
+ // "0.0100000000000000",
177
+ // "0.1000000000000000",
178
+ // "1.0000000000000000",
179
+ // "10.0000000000000000",
180
+ // "100.0000000000000000"
181
+ // ]
182
+ // }
183
+ const baseId = this.safeString(market, 'base');
184
+ const quoteId = this.safeString(market, 'quote');
185
+ const base = this.safeCurrencyCode(baseId);
186
+ const quote = this.safeCurrencyCode(quoteId);
187
+ const id = (base + quote);
188
+ return {
189
+ 'id': id,
190
+ 'symbol': base + '/' + quote,
191
+ 'base': base,
192
+ 'quote': quote,
193
+ 'settle': undefined,
194
+ 'baseId': baseId,
195
+ 'quoteId': quoteId,
196
+ 'settleId': undefined,
197
+ 'type': 'spot',
198
+ 'spot': true,
199
+ 'margin': false,
200
+ 'swap': false,
201
+ 'future': false,
202
+ 'option': false,
203
+ 'active': true,
204
+ 'contract': false,
205
+ 'linear': undefined,
206
+ 'inverse': undefined,
207
+ 'contractSize': undefined,
208
+ 'expiry': undefined,
209
+ 'expiryDatetime': undefined,
210
+ 'strike': undefined,
211
+ 'optionType': undefined,
212
+ 'precision': {
213
+ 'amount': undefined,
214
+ 'price': undefined,
215
+ },
216
+ 'limits': {
217
+ 'leverage': {
218
+ 'min': undefined,
219
+ 'max': undefined,
220
+ },
221
+ 'amount': {
222
+ 'min': undefined,
223
+ 'max': undefined,
224
+ },
225
+ 'price': {
226
+ 'min': undefined,
227
+ 'max': undefined,
228
+ },
229
+ 'cost': {
230
+ 'min': undefined,
231
+ 'max': undefined,
232
+ },
233
+ },
234
+ 'created': undefined,
235
+ 'info': market,
236
+ };
237
+ }
238
+ async fetchTickers(symbols = undefined, params = {}) {
239
+ /**
240
+ * @method
241
+ * @name bitunix#fetchTickers
242
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
243
+ * @see https://api-docs.bitunix.ir/#be8d9c51a2
244
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
245
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
246
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
247
+ */
248
+ await this.loadMarkets();
249
+ if (symbols !== undefined) {
250
+ symbols = this.marketSymbols(symbols);
251
+ }
252
+ const response = await this.publicGetWebApiV1CommonTickers();
253
+ const markets = this.safeList(response, 'data');
254
+ const result = {};
255
+ for (let i = 0; i < markets.length; i++) {
256
+ const ticker = this.parseTicker(markets[i]);
257
+ const symbol = ticker['symbol'];
258
+ result[symbol] = ticker;
259
+ }
260
+ return this.filterByArrayTickers(result, 'symbol', symbols);
261
+ }
262
+ async fetchTicker(symbol, params = {}) {
263
+ /**
264
+ * @method
265
+ * @name bitunix#fetchTicker
266
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
267
+ * @see https://api-docs.bitunix.ir/#be8d9c51a2
268
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
269
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
270
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
271
+ */
272
+ const ticker = await this.fetchTickers([symbol]);
273
+ return ticker[symbol];
274
+ }
275
+ parseTicker(ticker, market = undefined) {
276
+ // {
277
+ // symbol: "BTCUSDT",
278
+ // base: "BTC",
279
+ // quote: "USDT",
280
+ // close: "112832.34",
281
+ // rose24h: "0.2276416293",
282
+ // volume: "228310106.7861019"
283
+ // },
284
+ const marketType = 'spot';
285
+ const marketId = this.safeString(ticker, 'symbol');
286
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
287
+ const last = this.safeFloat(ticker, 'close', 0);
288
+ const change = this.safeFloat(ticker, 'rose24h', 0);
289
+ const quoteVolume = this.safeFloat(ticker, 'volume', 0);
290
+ let baseVolume = 0;
291
+ if (last !== 0) {
292
+ baseVolume = quoteVolume / last;
293
+ }
294
+ return this.safeTicker({
295
+ 'symbol': symbol,
296
+ 'timestamp': undefined,
297
+ 'datetime': undefined,
298
+ 'high': undefined,
299
+ 'low': undefined,
300
+ 'bid': undefined,
301
+ 'bidVolume': undefined,
302
+ 'ask': undefined,
303
+ 'askVolume': undefined,
304
+ 'vwap': undefined,
305
+ 'open': undefined,
306
+ 'close': last,
307
+ 'last': last,
308
+ 'previousClose': undefined,
309
+ 'change': change,
310
+ 'percentage': change,
311
+ 'average': undefined,
312
+ 'baseVolume': baseVolume,
313
+ 'quoteVolume': quoteVolume,
314
+ 'info': ticker,
315
+ }, market);
316
+ }
317
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
318
+ let url = this.urls['api']['market'] + '/' + path;
319
+ if (path === 'web/api/v1/common/tickers/') {
320
+ url = this.urls['api']['tickers'] + '/' + path;
321
+ }
322
+ headers = { 'Content-Type': 'application/json' };
323
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
324
+ }
325
325
  }
326
326
 
327
327
  exports["default"] = bitunix;