ccxt-ir 4.9.29 → 4.9.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,363 +5,363 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var raastin$1 = require('./abstract/raastin.js');
6
6
 
7
7
  // ----------------------------------------------------------------------------
8
- // ---------------------------------------------------------------------------
9
- /**
10
- * @class raastin
11
- * @augments Exchange
12
- * @description Set rateLimit to 1000 if fully verified
13
- */
14
- class raastin extends raastin$1["default"] {
15
- describe() {
16
- return this.deepExtend(super.describe(), {
17
- 'id': 'raastin',
18
- 'name': 'Raastin',
19
- 'countries': ['IR'],
20
- 'rateLimit': 1000,
21
- 'version': '1',
22
- 'certified': false,
23
- 'pro': false,
24
- 'has': {
25
- 'CORS': undefined,
26
- 'spot': true,
27
- 'margin': false,
28
- 'swap': false,
29
- 'future': false,
30
- 'option': false,
31
- 'addMargin': false,
32
- 'cancelAllOrders': false,
33
- 'cancelOrder': false,
34
- 'cancelOrders': false,
35
- 'createDepositAddress': false,
36
- 'createOrder': false,
37
- 'createStopLimitOrder': false,
38
- 'createStopMarketOrder': false,
39
- 'createStopOrder': false,
40
- 'editOrder': false,
41
- 'fetchBalance': false,
42
- 'fetchBorrowInterest': false,
43
- 'fetchBorrowRateHistories': false,
44
- 'fetchBorrowRateHistory': false,
45
- 'fetchClosedOrders': false,
46
- 'fetchCrossBorrowRate': false,
47
- 'fetchCrossBorrowRates': false,
48
- 'fetchCurrencies': false,
49
- 'fetchDepositAddress': false,
50
- 'fetchDeposits': false,
51
- 'fetchFundingHistory': false,
52
- 'fetchFundingRate': false,
53
- 'fetchFundingRateHistory': false,
54
- 'fetchFundingRates': false,
55
- 'fetchIndexOHLCV': false,
56
- 'fetchIsolatedBorrowRate': false,
57
- 'fetchIsolatedBorrowRates': false,
58
- 'fetchL2OrderBook': false,
59
- 'fetchL3OrderBook': false,
60
- 'fetchLedger': false,
61
- 'fetchLedgerEntry': false,
62
- 'fetchLeverageTiers': false,
63
- 'fetchMarkets': true,
64
- 'fetchMarkOHLCV': false,
65
- 'fetchMyTrades': false,
66
- 'fetchOHLCV': false,
67
- 'fetchOpenInterestHistory': false,
68
- 'fetchOpenOrders': false,
69
- 'fetchOrder': false,
70
- 'fetchOrderBook': 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/raastin/64x64.png',
90
- 'api': {
91
- 'public': 'https://api.raastin.com',
92
- },
93
- 'www': 'https://raastin.com',
94
- 'doc': [
95
- 'https://api.raastin.com/docs',
96
- ],
97
- },
98
- 'api': {
99
- 'public': {
100
- 'get': {
101
- 'api/v1/market/symbols': 1,
102
- 'api/v1/market/symbols/{symbol}/': 1,
103
- 'api/v1/market/depth/{symbol}': 1,
104
- },
105
- },
106
- },
107
- 'fees': {
108
- 'trading': {
109
- 'tierBased': false,
110
- 'percentage': true,
111
- 'maker': this.parseNumber('0'),
112
- 'taker': this.parseNumber('0.002'),
113
- },
114
- },
115
- });
116
- }
117
- async fetchMarkets(params = {}) {
118
- /**
119
- * @method
120
- * @name raastin#fetchMarkets
121
- * @description retrieves data on all markets for raastin
122
- * @param {object} [params] extra parameters specific to the exchange API endpoint
123
- * @returns {object[]} an array of objects representing market data
124
- */
125
- const response = await this.publicGetApiV1MarketSymbols(params);
126
- // Response is a flat array, not nested in 'result'
127
- const markets = response;
128
- const result = [];
129
- for (let i = 0; i < markets.length; i++) {
130
- const market = this.parseMarket(markets[i]);
131
- result.push(market);
132
- }
133
- return result;
134
- }
135
- parseMarket(market) {
136
- // {
137
- // "id": 1,
138
- // "name": "USDTIRT",
139
- // "asset": {
140
- // "id": 4,
141
- // "symbol": "USDT",
142
- // "precision": 8,
143
- // "step_size": 8,
144
- // "name": "tether",
145
- // "name_fa": "تتر",
146
- // "logo": "https://cdn.raastin.com/core-media-public/coins/logo/USDT.png",
147
- // "original_symbol": "USDT",
148
- // "original_name_fa": "تتر",
149
- // "trading_view_symbol": "BINANCE:USDTUSDT.P",
150
- // "otc_status": "active",
151
- // "price_page": true
152
- // },
153
- // "base_asset": {
154
- // "id": 1,
155
- // "symbol": "IRT",
156
- // "precision": 0,
157
- // "step_size": 8,
158
- // "name": "toman",
159
- // "name_fa": "تومان",
160
- // "logo": "https://cdn.raastin.com/core-media-public/coins/logo/IRT.png",
161
- // "original_symbol": "IRT",
162
- // "original_name_fa": "تومان",
163
- // "trading_view_symbol": "",
164
- // "otc_status": "active",
165
- // "price_page": true
166
- // },
167
- // "taker_fee": "0.002",
168
- // "maker_fee": "0",
169
- // "tick_size": 0,
170
- // "step_size": 2,
171
- // "min_trade_quantity": "0",
172
- // "max_trade_quantity": "1000000000000000000",
173
- // "enable": true,
174
- // "bookmark": false,
175
- // "margin_enable": true,
176
- // "strategy_enable": true
177
- // }
178
- const id = this.safeString(market, 'name');
179
- const asset = this.safeDict(market, 'asset', {});
180
- const baseAsset = this.safeDict(market, 'base_asset', {});
181
- let baseId = this.safeString(asset, 'symbol');
182
- let quoteId = this.safeString(baseAsset, 'symbol');
183
- const base = this.safeCurrencyCode(baseId);
184
- const quote = this.safeCurrencyCode(quoteId);
185
- baseId = baseId.toLowerCase();
186
- quoteId = quoteId.toLowerCase();
187
- const basePrecision = this.safeInteger(asset, 'precision');
188
- const quotePrecision = this.safeInteger(baseAsset, 'precision');
189
- const minAmount = this.safeString(market, 'min_trade_quantity');
190
- const maxAmount = this.safeString(market, 'max_trade_quantity');
191
- const enabled = this.safeBool(market, 'enable', true);
192
- const marginEnabled = this.safeBool(market, 'margin_enable', false);
193
- return {
194
- 'id': id,
195
- 'symbol': base + '/' + quote,
196
- 'base': base,
197
- 'quote': quote,
198
- 'settle': undefined,
199
- 'baseId': baseId,
200
- 'quoteId': quoteId,
201
- 'settleId': undefined,
202
- 'type': 'spot',
203
- 'spot': true,
204
- 'margin': marginEnabled,
205
- 'swap': false,
206
- 'future': false,
207
- 'option': false,
208
- 'active': enabled,
209
- 'contract': false,
210
- 'linear': undefined,
211
- 'inverse': undefined,
212
- 'contractSize': undefined,
213
- 'expiry': undefined,
214
- 'expiryDatetime': undefined,
215
- 'strike': undefined,
216
- 'optionType': undefined,
217
- 'precision': {
218
- 'amount': basePrecision,
219
- 'price': quotePrecision,
220
- },
221
- 'limits': {
222
- 'leverage': {
223
- 'min': undefined,
224
- 'max': undefined,
225
- },
226
- 'amount': {
227
- 'min': this.parseNumber(minAmount),
228
- 'max': this.parseNumber(maxAmount),
229
- },
230
- 'price': {
231
- 'min': undefined,
232
- 'max': undefined,
233
- },
234
- 'cost': {
235
- 'min': undefined,
236
- 'max': undefined,
237
- },
238
- },
239
- 'created': undefined,
240
- 'info': market,
241
- };
242
- }
243
- async fetchTickers(symbols = undefined, params = {}) {
244
- /**
245
- * @method
246
- * @name raastin#fetchTickers
247
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
248
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
249
- * @param {object} [params] extra parameters specific to the exchange API endpoint
250
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
251
- */
252
- await this.loadMarkets();
253
- if (symbols !== undefined) {
254
- symbols = this.marketSymbols(symbols);
255
- }
256
- const response = await this.publicGetApiV1MarketSymbols(params);
257
- const markets = this.safeList(response, response);
258
- const result = {};
259
- for (let i = 0; i < markets.length; i++) {
260
- const marketData = markets[i];
261
- const ticker = this.parseTicker(marketData);
262
- const symbol = ticker['symbol'];
263
- result[symbol] = ticker;
264
- }
265
- return this.filterByArrayTickers(result, 'symbol', symbols);
266
- }
267
- async fetchTicker(symbol, params = {}) {
268
- /**
269
- * @method
270
- * @name raastin#fetchTicker
271
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
272
- * @param {string} symbol unified symbol of the market to fetch the ticker for
273
- * @param {object} [params] extra parameters specific to the exchange API endpoint
274
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
275
- */
276
- await this.loadMarkets();
277
- const market = this.market(symbol);
278
- const request = {
279
- 'symbol': market['id'],
280
- };
281
- const response = await this.publicGetApiV1MarketSymbolsSymbol(request);
282
- return this.parseTicker(response, market);
283
- }
284
- parseTicker(ticker, market = undefined) {
285
- // Raastin ticker response has the same structure as market data
286
- // We extract available price/volume information
287
- const marketType = 'spot';
288
- const marketId = this.safeString(ticker, 'name');
289
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
290
- // Since the exact ticker fields are not provided in the user's example,
291
- // we'll set up the basic structure. These may need adjustment based on actual API response.
292
- const last = this.safeFloat(ticker, 'last_price', 0);
293
- const high = this.safeFloat(ticker, '24h_high', 0);
294
- const low = this.safeFloat(ticker, '24h_low', 0);
295
- const baseVolume = this.safeFloat(ticker, '24h_volume', 0);
296
- const quoteVolume = this.safeFloat(ticker, '24h_quote_volume', 0);
297
- const bid = this.safeFloat(ticker, 'bid_price', 0);
298
- const ask = this.safeFloat(ticker, 'ask_price', 0);
299
- return this.safeTicker({
300
- 'symbol': symbol,
301
- 'timestamp': undefined,
302
- 'datetime': undefined,
303
- 'high': high,
304
- 'low': low,
305
- 'bid': bid,
306
- 'bidVolume': undefined,
307
- 'ask': ask,
308
- 'askVolume': undefined,
309
- 'vwap': undefined,
310
- 'open': undefined,
311
- 'close': last,
312
- 'last': last,
313
- 'previousClose': undefined,
314
- 'change': undefined,
315
- 'percentage': undefined,
316
- 'average': undefined,
317
- 'baseVolume': baseVolume,
318
- 'quoteVolume': quoteVolume,
319
- 'info': ticker,
320
- }, market);
321
- }
322
- async fetchOrderBook(symbol, limit = undefined, params = {}) {
323
- /**
324
- * @method
325
- * @name raastin#fetchOrderBook
326
- * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
327
- * @param {string} symbol unified symbol of the market to fetch the order book for
328
- * @param {int} [limit] max number of entries per orderbook to return
329
- * @param {object} [params] extra parameters specific to the exchange API endpoint
330
- * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
331
- */
332
- await this.loadMarkets();
333
- const market = this.market(symbol);
334
- const request = {
335
- 'symbol': market['id'],
336
- };
337
- const response = await this.publicGetApiV1MarketDepthSymbol(request);
338
- // Response structure:
339
- // {
340
- // "last_trade": { "amount": "0.31", "price": "164311", "total": "50936" },
341
- // "bids": [{ "price": "164003", "amount": "19.99", "depth": "1", "total": "3278419" }],
342
- // "asks": [{ "price": "166000", "amount": "47.79", "depth": "2", "total": "7933140" }]
343
- // }
344
- const timestamp = Date.now();
345
- return this.parseOrderBook(response, symbol, timestamp, 'bids', 'asks', 'price', 'amount');
346
- }
347
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
348
- let url = this.urls['api']['public'] + '/' + path;
349
- // Handle path parameters like {symbol}
350
- if (path.indexOf('{symbol}') >= 0) {
351
- const symbol = this.safeString(params, 'symbol');
352
- if (symbol !== undefined) {
353
- url = url.replace('{symbol}', symbol);
354
- params = this.omit(params, 'symbol');
355
- }
356
- }
357
- const query = this.omit(params, this.extractParams(path));
358
- // Add query parameters if any remain
359
- if (Object.keys(query).length) {
360
- url = url + '?' + this.urlencode(query);
361
- }
362
- headers = { 'Content-Type': 'application/json' };
363
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
364
- }
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class raastin
11
+ * @augments Exchange
12
+ * @description Set rateLimit to 1000 if fully verified
13
+ */
14
+ class raastin extends raastin$1["default"] {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'raastin',
18
+ 'name': 'Raastin',
19
+ 'countries': ['IR'],
20
+ 'rateLimit': 1000,
21
+ 'version': '1',
22
+ 'certified': false,
23
+ 'pro': false,
24
+ 'has': {
25
+ 'CORS': undefined,
26
+ 'spot': true,
27
+ 'margin': false,
28
+ 'swap': false,
29
+ 'future': false,
30
+ 'option': false,
31
+ 'addMargin': false,
32
+ 'cancelAllOrders': false,
33
+ 'cancelOrder': false,
34
+ 'cancelOrders': false,
35
+ 'createDepositAddress': false,
36
+ 'createOrder': false,
37
+ 'createStopLimitOrder': false,
38
+ 'createStopMarketOrder': false,
39
+ 'createStopOrder': false,
40
+ 'editOrder': false,
41
+ 'fetchBalance': false,
42
+ 'fetchBorrowInterest': false,
43
+ 'fetchBorrowRateHistories': false,
44
+ 'fetchBorrowRateHistory': false,
45
+ 'fetchClosedOrders': false,
46
+ 'fetchCrossBorrowRate': false,
47
+ 'fetchCrossBorrowRates': false,
48
+ 'fetchCurrencies': false,
49
+ 'fetchDepositAddress': false,
50
+ 'fetchDeposits': false,
51
+ 'fetchFundingHistory': false,
52
+ 'fetchFundingRate': false,
53
+ 'fetchFundingRateHistory': false,
54
+ 'fetchFundingRates': false,
55
+ 'fetchIndexOHLCV': false,
56
+ 'fetchIsolatedBorrowRate': false,
57
+ 'fetchIsolatedBorrowRates': false,
58
+ 'fetchL2OrderBook': false,
59
+ 'fetchL3OrderBook': false,
60
+ 'fetchLedger': false,
61
+ 'fetchLedgerEntry': false,
62
+ 'fetchLeverageTiers': false,
63
+ 'fetchMarkets': true,
64
+ 'fetchMarkOHLCV': false,
65
+ 'fetchMyTrades': false,
66
+ 'fetchOHLCV': false,
67
+ 'fetchOpenInterestHistory': false,
68
+ 'fetchOpenOrders': false,
69
+ 'fetchOrder': false,
70
+ 'fetchOrderBook': 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/raastin/64x64.png',
90
+ 'api': {
91
+ 'public': 'https://api.raastin.com',
92
+ },
93
+ 'www': 'https://raastin.com',
94
+ 'doc': [
95
+ 'https://api.raastin.com/docs',
96
+ ],
97
+ },
98
+ 'api': {
99
+ 'public': {
100
+ 'get': {
101
+ 'api/v1/market/symbols': 1,
102
+ 'api/v1/market/symbols/{symbol}/': 1,
103
+ 'api/v1/market/depth/{symbol}': 1,
104
+ },
105
+ },
106
+ },
107
+ 'fees': {
108
+ 'trading': {
109
+ 'tierBased': false,
110
+ 'percentage': true,
111
+ 'maker': this.parseNumber('0'),
112
+ 'taker': this.parseNumber('0.002'),
113
+ },
114
+ },
115
+ });
116
+ }
117
+ async fetchMarkets(params = {}) {
118
+ /**
119
+ * @method
120
+ * @name raastin#fetchMarkets
121
+ * @description retrieves data on all markets for raastin
122
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
123
+ * @returns {object[]} an array of objects representing market data
124
+ */
125
+ const response = await this.publicGetApiV1MarketSymbols(params);
126
+ // Response is a flat array, not nested in 'result'
127
+ const markets = response;
128
+ const result = [];
129
+ for (let i = 0; i < markets.length; i++) {
130
+ const market = this.parseMarket(markets[i]);
131
+ result.push(market);
132
+ }
133
+ return result;
134
+ }
135
+ parseMarket(market) {
136
+ // {
137
+ // "id": 1,
138
+ // "name": "USDTIRT",
139
+ // "asset": {
140
+ // "id": 4,
141
+ // "symbol": "USDT",
142
+ // "precision": 8,
143
+ // "step_size": 8,
144
+ // "name": "tether",
145
+ // "name_fa": "تتر",
146
+ // "logo": "https://cdn.raastin.com/core-media-public/coins/logo/USDT.png",
147
+ // "original_symbol": "USDT",
148
+ // "original_name_fa": "تتر",
149
+ // "trading_view_symbol": "BINANCE:USDTUSDT.P",
150
+ // "otc_status": "active",
151
+ // "price_page": true
152
+ // },
153
+ // "base_asset": {
154
+ // "id": 1,
155
+ // "symbol": "IRT",
156
+ // "precision": 0,
157
+ // "step_size": 8,
158
+ // "name": "toman",
159
+ // "name_fa": "تومان",
160
+ // "logo": "https://cdn.raastin.com/core-media-public/coins/logo/IRT.png",
161
+ // "original_symbol": "IRT",
162
+ // "original_name_fa": "تومان",
163
+ // "trading_view_symbol": "",
164
+ // "otc_status": "active",
165
+ // "price_page": true
166
+ // },
167
+ // "taker_fee": "0.002",
168
+ // "maker_fee": "0",
169
+ // "tick_size": 0,
170
+ // "step_size": 2,
171
+ // "min_trade_quantity": "0",
172
+ // "max_trade_quantity": "1000000000000000000",
173
+ // "enable": true,
174
+ // "bookmark": false,
175
+ // "margin_enable": true,
176
+ // "strategy_enable": true
177
+ // }
178
+ const id = this.safeString(market, 'name');
179
+ const asset = this.safeDict(market, 'asset', {});
180
+ const baseAsset = this.safeDict(market, 'base_asset', {});
181
+ let baseId = this.safeString(asset, 'symbol');
182
+ let quoteId = this.safeString(baseAsset, 'symbol');
183
+ const base = this.safeCurrencyCode(baseId);
184
+ const quote = this.safeCurrencyCode(quoteId);
185
+ baseId = baseId.toLowerCase();
186
+ quoteId = quoteId.toLowerCase();
187
+ const basePrecision = this.safeInteger(asset, 'precision');
188
+ const quotePrecision = this.safeInteger(baseAsset, 'precision');
189
+ const minAmount = this.safeString(market, 'min_trade_quantity');
190
+ const maxAmount = this.safeString(market, 'max_trade_quantity');
191
+ const enabled = this.safeBool(market, 'enable', true);
192
+ const marginEnabled = this.safeBool(market, 'margin_enable', false);
193
+ return {
194
+ 'id': id,
195
+ 'symbol': base + '/' + quote,
196
+ 'base': base,
197
+ 'quote': quote,
198
+ 'settle': undefined,
199
+ 'baseId': baseId,
200
+ 'quoteId': quoteId,
201
+ 'settleId': undefined,
202
+ 'type': 'spot',
203
+ 'spot': true,
204
+ 'margin': marginEnabled,
205
+ 'swap': false,
206
+ 'future': false,
207
+ 'option': false,
208
+ 'active': enabled,
209
+ 'contract': false,
210
+ 'linear': undefined,
211
+ 'inverse': undefined,
212
+ 'contractSize': undefined,
213
+ 'expiry': undefined,
214
+ 'expiryDatetime': undefined,
215
+ 'strike': undefined,
216
+ 'optionType': undefined,
217
+ 'precision': {
218
+ 'amount': basePrecision,
219
+ 'price': quotePrecision,
220
+ },
221
+ 'limits': {
222
+ 'leverage': {
223
+ 'min': undefined,
224
+ 'max': undefined,
225
+ },
226
+ 'amount': {
227
+ 'min': this.parseNumber(minAmount),
228
+ 'max': this.parseNumber(maxAmount),
229
+ },
230
+ 'price': {
231
+ 'min': undefined,
232
+ 'max': undefined,
233
+ },
234
+ 'cost': {
235
+ 'min': undefined,
236
+ 'max': undefined,
237
+ },
238
+ },
239
+ 'created': undefined,
240
+ 'info': market,
241
+ };
242
+ }
243
+ async fetchTickers(symbols = undefined, params = {}) {
244
+ /**
245
+ * @method
246
+ * @name raastin#fetchTickers
247
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
248
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
249
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
250
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
251
+ */
252
+ await this.loadMarkets();
253
+ if (symbols !== undefined) {
254
+ symbols = this.marketSymbols(symbols);
255
+ }
256
+ const response = await this.publicGetApiV1MarketSymbols(params);
257
+ const markets = this.safeList(response, response);
258
+ const result = {};
259
+ for (let i = 0; i < markets.length; i++) {
260
+ const marketData = markets[i];
261
+ const ticker = this.parseTicker(marketData);
262
+ const symbol = ticker['symbol'];
263
+ result[symbol] = ticker;
264
+ }
265
+ return this.filterByArrayTickers(result, 'symbol', symbols);
266
+ }
267
+ async fetchTicker(symbol, params = {}) {
268
+ /**
269
+ * @method
270
+ * @name raastin#fetchTicker
271
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
272
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
273
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
274
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
275
+ */
276
+ await this.loadMarkets();
277
+ const market = this.market(symbol);
278
+ const request = {
279
+ 'symbol': market['id'],
280
+ };
281
+ const response = await this.publicGetApiV1MarketSymbolsSymbol(request);
282
+ return this.parseTicker(response, market);
283
+ }
284
+ parseTicker(ticker, market = undefined) {
285
+ // Raastin ticker response has the same structure as market data
286
+ // We extract available price/volume information
287
+ const marketType = 'spot';
288
+ const marketId = this.safeString(ticker, 'name');
289
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
290
+ // Since the exact ticker fields are not provided in the user's example,
291
+ // we'll set up the basic structure. These may need adjustment based on actual API response.
292
+ const last = this.safeFloat(ticker, 'last_price', 0);
293
+ const high = this.safeFloat(ticker, '24h_high', 0);
294
+ const low = this.safeFloat(ticker, '24h_low', 0);
295
+ const baseVolume = this.safeFloat(ticker, '24h_volume', 0);
296
+ const quoteVolume = this.safeFloat(ticker, '24h_quote_volume', 0);
297
+ const bid = this.safeFloat(ticker, 'bid_price', 0);
298
+ const ask = this.safeFloat(ticker, 'ask_price', 0);
299
+ return this.safeTicker({
300
+ 'symbol': symbol,
301
+ 'timestamp': undefined,
302
+ 'datetime': undefined,
303
+ 'high': high,
304
+ 'low': low,
305
+ 'bid': bid,
306
+ 'bidVolume': undefined,
307
+ 'ask': ask,
308
+ 'askVolume': undefined,
309
+ 'vwap': undefined,
310
+ 'open': undefined,
311
+ 'close': last,
312
+ 'last': last,
313
+ 'previousClose': undefined,
314
+ 'change': undefined,
315
+ 'percentage': undefined,
316
+ 'average': undefined,
317
+ 'baseVolume': baseVolume,
318
+ 'quoteVolume': quoteVolume,
319
+ 'info': ticker,
320
+ }, market);
321
+ }
322
+ async fetchOrderBook(symbol, limit = undefined, params = {}) {
323
+ /**
324
+ * @method
325
+ * @name raastin#fetchOrderBook
326
+ * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
327
+ * @param {string} symbol unified symbol of the market to fetch the order book for
328
+ * @param {int} [limit] max number of entries per orderbook to return
329
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
330
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
331
+ */
332
+ await this.loadMarkets();
333
+ const market = this.market(symbol);
334
+ const request = {
335
+ 'symbol': market['id'],
336
+ };
337
+ const response = await this.publicGetApiV1MarketDepthSymbol(request);
338
+ // Response structure:
339
+ // {
340
+ // "last_trade": { "amount": "0.31", "price": "164311", "total": "50936" },
341
+ // "bids": [{ "price": "164003", "amount": "19.99", "depth": "1", "total": "3278419" }],
342
+ // "asks": [{ "price": "166000", "amount": "47.79", "depth": "2", "total": "7933140" }]
343
+ // }
344
+ const timestamp = Date.now();
345
+ return this.parseOrderBook(response, symbol, timestamp, 'bids', 'asks', 'price', 'amount');
346
+ }
347
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
348
+ let url = this.urls['api']['public'] + '/' + path;
349
+ // Handle path parameters like {symbol}
350
+ if (path.indexOf('{symbol}') >= 0) {
351
+ const symbol = this.safeString(params, 'symbol');
352
+ if (symbol !== undefined) {
353
+ url = url.replace('{symbol}', symbol);
354
+ params = this.omit(params, 'symbol');
355
+ }
356
+ }
357
+ const query = this.omit(params, this.extractParams(path));
358
+ // Add query parameters if any remain
359
+ if (Object.keys(query).length) {
360
+ url = url + '?' + this.urlencode(query);
361
+ }
362
+ headers = { 'Content-Type': 'application/json' };
363
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
364
+ }
365
365
  }
366
366
 
367
367
  exports["default"] = raastin;