ccxt-ir 4.9.32 → 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/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.9.32';
41
+ const version = '4.10.0';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import abantether from './src/abantether.js';
@@ -48,6 +48,7 @@ import apex from './src/apex.js';
48
48
  import arzinja from './src/arzinja.js';
49
49
  import arzplus from './src/arzplus.js';
50
50
  import ascendex from './src/ascendex.js';
51
+ import asretether from './src/asretether.js';
51
52
  import bequant from './src/bequant.js';
52
53
  import bigone from './src/bigone.js';
53
54
  import binance from './src/binance.js';
@@ -270,6 +271,7 @@ const exchanges = {
270
271
  'arzinja': arzinja,
271
272
  'arzplus': arzplus,
272
273
  'ascendex': ascendex,
274
+ 'asretether': asretether,
273
275
  'bequant': bequant,
274
276
  'bigone': bigone,
275
277
  'binance': binance,
@@ -498,6 +500,6 @@ pro.exchanges = Object.keys(pro);
498
500
  pro['Exchange'] = Exchange; // now the same for rest and ts
499
501
  //-----------------------------------------------------------------------------
500
502
  const ccxt = Object.assign({ version, Exchange, Precise, 'exchanges': Object.keys(exchanges), 'pro': pro }, exchanges, functions, errors);
501
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError, abantether, afratether, alpaca, apex, arzinja, arzplus, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit24, bit2c, bitbank, bitbarg, bitbns, bitfinex, bitflyer, bitget, bithumb, bitimen, bitir, bitmart, bitmex, bitopro, bitpin, bitrue, bitso, bitstamp, bitteam, bittrade, bitunix, bitvavo, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, bydfi, cafearz, cex, coinbase, coinbaseadvanced, coinbaseexchange, coinbaseinternational, coincatch, coincheck, coinex, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, cryptomus, defx, delta, deribit, derive, digifinex, ellipx, eterex, excoino, exir, exmo, exnovin, farhadexchange, fmfwio, foxbit, gate, gateio, gemini, hamtapay, hashkey, hibachi, hitbtc, hitobit, hollaex, htx, huobi, hyperliquid, independentreserve, indodax, iranexchange, jibitex, kcex, kifpoolme, kraken, krakenfutures, kucoin, kucoinfutures, latoken, lbank, luno, mazdax, mercado, mexc, modetrade, myokx, ndax, nobitex, novadax, oceanex, okcoin, okexchange, okx, okxus, ompfinex, onetrading, oxfun, p2b, paradex, paymium, phemex, pingi, poloniex, pooleno, probit, raastin, ramzinex, sarmayex, sarrafex, tabdeal, tehran_exchange, tetherland, timex, tokocrypto, toobit, tradeogre, twox, ubitex, upbit, vertex, wallex, wavesexchange, whitebit, woo, woofipro, xt, yobit, zaif, zonda, };
503
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError, abantether, afratether, alpaca, apex, arzinja, arzplus, ascendex, asretether, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit24, bit2c, bitbank, bitbarg, bitbns, bitfinex, bitflyer, bitget, bithumb, bitimen, bitir, bitmart, bitmex, bitopro, bitpin, bitrue, bitso, bitstamp, bitteam, bittrade, bitunix, bitvavo, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, bydfi, cafearz, cex, coinbase, coinbaseadvanced, coinbaseexchange, coinbaseinternational, coincatch, coincheck, coinex, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, cryptomus, defx, delta, deribit, derive, digifinex, ellipx, eterex, excoino, exir, exmo, exnovin, farhadexchange, fmfwio, foxbit, gate, gateio, gemini, hamtapay, hashkey, hibachi, hitbtc, hitobit, hollaex, htx, huobi, hyperliquid, independentreserve, indodax, iranexchange, jibitex, kcex, kifpoolme, kraken, krakenfutures, kucoin, kucoinfutures, latoken, lbank, luno, mazdax, mercado, mexc, modetrade, myokx, ndax, nobitex, novadax, oceanex, okcoin, okexchange, okx, okxus, ompfinex, onetrading, oxfun, p2b, paradex, paymium, phemex, pingi, poloniex, pooleno, probit, raastin, ramzinex, sarmayex, sarrafex, tabdeal, tehran_exchange, tetherland, timex, tokocrypto, toobit, tradeogre, twox, ubitex, upbit, vertex, wallex, wavesexchange, whitebit, woo, woofipro, xt, yobit, zaif, zonda, };
502
504
  export default ccxt;
503
505
  //-----------------------------------------------------------------------------
@@ -0,0 +1,8 @@
1
+ import { implicitReturnType } from '../base/types.js';
2
+ import { Exchange as _Exchange } from '../base/Exchange.js';
3
+ interface Exchange {
4
+ publicGetV2Market(params?: {}): Promise<implicitReturnType>;
5
+ }
6
+ declare abstract class Exchange extends _Exchange {
7
+ }
8
+ 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;
@@ -4,6 +4,7 @@ interface Exchange {
4
4
  publicGetApiV1MarketSymbols(params?: {}): Promise<implicitReturnType>;
5
5
  publicGetApiV1MarketSymbolsSymbol(params?: {}): Promise<implicitReturnType>;
6
6
  publicGetApiV1MarketDepthSymbol(params?: {}): Promise<implicitReturnType>;
7
+ publicGetApiV1Market(params?: {}): Promise<implicitReturnType>;
7
8
  }
8
9
  declare abstract class Exchange extends _Exchange {
9
10
  }
@@ -0,0 +1,21 @@
1
+ import Exchange from './abstract/asretether.js';
2
+ import { Market, Strings, Ticker, Tickers } from './base/types.js';
3
+ /**
4
+ * @class asretether
5
+ * @augments Exchange
6
+ * @description Set rateLimit to 1000 if fully verified
7
+ */
8
+ export default class asretether 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,324 @@
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/asretether.js';
9
+ // ---------------------------------------------------------------------------
10
+ /**
11
+ * @class asretether
12
+ * @augments Exchange
13
+ * @description Set rateLimit to 1000 if fully verified
14
+ */
15
+ export default class asretether extends Exchange {
16
+ describe() {
17
+ return this.deepExtend(super.describe(), {
18
+ 'id': 'asretether',
19
+ 'name': 'Asretether',
20
+ 'countries': ['IR'],
21
+ 'rateLimit': 1000,
22
+ 'version': '2',
23
+ 'certified': false,
24
+ 'pro': false,
25
+ 'has': {
26
+ 'CORS': undefined,
27
+ 'spot': true,
28
+ 'margin': false,
29
+ 'swap': false,
30
+ 'future': false,
31
+ 'option': false,
32
+ 'addMargin': false,
33
+ 'cancelAllOrders': false,
34
+ 'cancelOrder': false,
35
+ 'cancelOrders': false,
36
+ 'createDepositAddress': false,
37
+ 'createOrder': false,
38
+ 'createStopLimitOrder': false,
39
+ 'createStopMarketOrder': false,
40
+ 'createStopOrder': false,
41
+ 'editOrder': false,
42
+ 'fetchBalance': false,
43
+ 'fetchBorrowInterest': false,
44
+ 'fetchBorrowRateHistories': false,
45
+ 'fetchBorrowRateHistory': false,
46
+ 'fetchClosedOrders': false,
47
+ 'fetchCrossBorrowRate': false,
48
+ 'fetchCrossBorrowRates': false,
49
+ 'fetchCurrencies': false,
50
+ 'fetchDepositAddress': false,
51
+ 'fetchDeposits': false,
52
+ 'fetchFundingHistory': false,
53
+ 'fetchFundingRate': false,
54
+ 'fetchFundingRateHistory': false,
55
+ 'fetchFundingRates': false,
56
+ 'fetchIndexOHLCV': false,
57
+ 'fetchIsolatedBorrowRate': false,
58
+ 'fetchIsolatedBorrowRates': false,
59
+ 'fetchL2OrderBook': false,
60
+ 'fetchL3OrderBook': false,
61
+ 'fetchLedger': false,
62
+ 'fetchLedgerEntry': false,
63
+ 'fetchLeverageTiers': false,
64
+ 'fetchMarkets': true,
65
+ 'fetchMarkOHLCV': false,
66
+ 'fetchMyTrades': false,
67
+ 'fetchOHLCV': false,
68
+ 'fetchOpenInterestHistory': false,
69
+ 'fetchOpenOrders': false,
70
+ 'fetchOrder': false,
71
+ 'fetchOrderBook': false,
72
+ 'fetchOrders': false,
73
+ 'fetchOrderTrades': false,
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
+ 'otc': true,
84
+ 'setLeverage': false,
85
+ 'setMarginMode': false,
86
+ 'transfer': false,
87
+ 'withdraw': false,
88
+ },
89
+ 'comment': 'OTC market for USDT and other cryptocurrencies',
90
+ 'urls': {
91
+ 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/asretether/64x64.png',
92
+ 'api': {
93
+ 'public': 'https://api.asretether.com',
94
+ },
95
+ 'www': 'https://asretether.com',
96
+ 'doc': [
97
+ 'https://api.asretether.com/docs',
98
+ ],
99
+ },
100
+ 'api': {
101
+ 'public': {
102
+ 'get': {
103
+ 'v2/market': 1,
104
+ },
105
+ },
106
+ },
107
+ 'fees': {
108
+ 'trading': {
109
+ 'tierBased': false,
110
+ 'percentage': true,
111
+ 'maker': this.parseNumber('0'),
112
+ 'taker': this.parseNumber('0'),
113
+ },
114
+ },
115
+ });
116
+ }
117
+ async fetchMarkets(params = {}) {
118
+ /**
119
+ * @method
120
+ * @name asretether#fetchMarkets
121
+ * @description retrieves data on all markets for asretether
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.publicGetV2Market(params);
126
+ const data = this.safeList(response, 'data', []);
127
+ const result = [];
128
+ for (let i = 0; i < data.length; i++) {
129
+ const market = this.parseMarket(data[i]);
130
+ result.push(market);
131
+ }
132
+ return result;
133
+ }
134
+ parseMarket(market) {
135
+ // {
136
+ // id: 2,
137
+ // symbol: "USDT-IRT",
138
+ // status: "ACTIVE",
139
+ // high_24h: "181978",
140
+ // low_24h: "172874",
141
+ // irt_high_24h: 0,
142
+ // irt_low_24h: 0,
143
+ // change_24h: 0,
144
+ // volume_24h: 100000,
145
+ // price: {
146
+ // price_buy: "178410",
147
+ // price_sell: "176402",
148
+ // price_in_tether: "1.0000"
149
+ // },
150
+ // base_currency: {
151
+ // slug: "USDT",
152
+ // decimals: 6,
153
+ // full_name: "Tether",
154
+ // persian_name: "تتر",
155
+ // icon_url: "https://box.asretether.com/currency-icons/usdt.png"
156
+ // },
157
+ // quote_currency: {
158
+ // slug: "IRT",
159
+ // decimals: 0,
160
+ // full_name: "IR Toman",
161
+ // persian_name: "تومان",
162
+ // icon_url: "https://box.asretether.com/currency-icons/irt.png"
163
+ // }
164
+ // },
165
+ const id = this.safeString(market, 'symbol');
166
+ const baseCurrency = this.safeDict(market, 'base_currency', {});
167
+ const quoteCurrency = this.safeDict(market, 'quote_currency', {});
168
+ const baseId = this.safeString(baseCurrency, 'slug');
169
+ const quoteId = this.safeString(quoteCurrency, 'slug');
170
+ const base = this.safeCurrencyCode(baseId);
171
+ const quote = this.safeCurrencyCode(quoteId);
172
+ const basePrecision = this.safeInteger(baseCurrency, 'decimals');
173
+ const quotePrecision = this.safeInteger(quoteCurrency, 'decimals');
174
+ const status = this.safeString(market, 'status');
175
+ const enabled = status === 'ACTIVE';
176
+ return {
177
+ 'id': id,
178
+ 'symbol': base + '/' + quote,
179
+ 'base': base,
180
+ 'quote': quote,
181
+ 'settle': undefined,
182
+ 'baseId': baseId,
183
+ 'quoteId': quoteId,
184
+ 'settleId': undefined,
185
+ 'type': 'otc',
186
+ 'spot': false,
187
+ 'margin': false,
188
+ 'swap': false,
189
+ 'future': false,
190
+ 'option': false,
191
+ 'active': enabled,
192
+ 'contract': false,
193
+ 'linear': undefined,
194
+ 'inverse': undefined,
195
+ 'contractSize': undefined,
196
+ 'expiry': undefined,
197
+ 'expiryDatetime': undefined,
198
+ 'strike': undefined,
199
+ 'optionType': undefined,
200
+ 'precision': {
201
+ 'amount': basePrecision,
202
+ 'price': quotePrecision,
203
+ },
204
+ 'limits': {
205
+ 'leverage': {
206
+ 'min': undefined,
207
+ 'max': undefined,
208
+ },
209
+ 'amount': {
210
+ 'min': undefined,
211
+ 'max': undefined,
212
+ },
213
+ 'price': {
214
+ 'min': undefined,
215
+ 'max': undefined,
216
+ },
217
+ 'cost': {
218
+ 'min': undefined,
219
+ 'max': undefined,
220
+ },
221
+ },
222
+ 'created': undefined,
223
+ 'info': market,
224
+ };
225
+ }
226
+ async fetchTickers(symbols = undefined, params = {}) {
227
+ /**
228
+ * @method
229
+ * @name asretether#fetchTickers
230
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
231
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
232
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
233
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
234
+ */
235
+ await this.loadMarkets();
236
+ if (symbols !== undefined) {
237
+ symbols = this.marketSymbols(symbols);
238
+ }
239
+ const response = await this.publicGetV2Market(params);
240
+ const data = this.safeList(response, 'data', []);
241
+ const result = {};
242
+ for (let i = 0; i < data.length; i++) {
243
+ const ticker = this.parseTicker(data[i]);
244
+ const symbol = ticker['symbol'];
245
+ result[symbol] = ticker;
246
+ }
247
+ return this.filterByArrayTickers(result, 'symbol', symbols);
248
+ }
249
+ async fetchTicker(symbol, params = {}) {
250
+ /**
251
+ * @method
252
+ * @name asretether#fetchTicker
253
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
254
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
255
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
256
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
257
+ */
258
+ await this.loadMarkets();
259
+ const market = this.market(symbol);
260
+ const request = {
261
+ 'symbol': market['id'],
262
+ };
263
+ const response = await this.publicGetV2Market(request);
264
+ const data = this.safeList(response, 'data', []);
265
+ if (data.length > 0) {
266
+ return this.parseTicker(data[0], market);
267
+ }
268
+ throw new Error('Ticker not found');
269
+ }
270
+ parseTicker(ticker, market = undefined) {
271
+ const baseCurrency = this.safeDict(ticker, 'base_currency', {});
272
+ const quoteCurrency = this.safeDict(ticker, 'quote_currency', {});
273
+ const baseId = this.safeString(baseCurrency, 'slug');
274
+ const quoteId = this.safeString(quoteCurrency, 'slug');
275
+ const base = this.safeCurrencyCode(baseId);
276
+ const quote = this.safeCurrencyCode(quoteId);
277
+ const symbol = base + '/' + quote;
278
+ // Handle price selection based on quote currency
279
+ const price = this.safeDict(ticker, 'price', {});
280
+ let last = undefined;
281
+ if (quote === 'IRT') {
282
+ last = this.safeFloat(price, 'price_sell');
283
+ }
284
+ else if (quote === 'USDT') {
285
+ last = this.safeFloat(price, 'price_in_tether');
286
+ }
287
+ const high = this.safeFloat(ticker, 'high_24h');
288
+ const low = this.safeFloat(ticker, 'low_24h');
289
+ const baseVolume = this.safeFloat(ticker, 'volume_24h');
290
+ return this.safeTicker({
291
+ 'symbol': symbol,
292
+ 'timestamp': undefined,
293
+ 'datetime': undefined,
294
+ 'high': high,
295
+ 'low': low,
296
+ 'bid': undefined,
297
+ 'bidVolume': undefined,
298
+ 'ask': undefined,
299
+ 'askVolume': undefined,
300
+ 'vwap': undefined,
301
+ 'open': undefined,
302
+ 'close': last,
303
+ 'last': last,
304
+ 'previousClose': undefined,
305
+ 'change': this.safeFloat(ticker, 'change_24h'),
306
+ 'percentage': undefined,
307
+ 'average': undefined,
308
+ 'baseVolume': baseVolume,
309
+ 'quoteVolume': undefined,
310
+ 'info': ticker,
311
+ }, market);
312
+ }
313
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
314
+ let url = this.urls['api']['public'] + '/' + path;
315
+ const query = this.omit(params, this.extractParams(path));
316
+ query['limit'] = this.safeString(query, 'limit', '1000');
317
+ // Add query parameters if any remain
318
+ if (Object.keys(query).length) {
319
+ url = url + '?' + this.urlencode(query);
320
+ }
321
+ headers = { 'Content-Type': 'application/json' };
322
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
323
+ }
324
+ }
@@ -9,9 +9,11 @@ export default class raastin extends Exchange {
9
9
  describe(): any;
10
10
  fetchMarkets(params?: {}): Promise<Market[]>;
11
11
  parseMarket(market: any): Market;
12
+ parseOtcMarket(market: any): Market;
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
  fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
16
18
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
17
19
  url: string;
package/js/src/raastin.js CHANGED
@@ -80,6 +80,7 @@ export default class raastin extends Exchange {
80
80
  'fetchTradingFee': false,
81
81
  'fetchTradingFees': false,
82
82
  'fetchWithdrawals': false,
83
+ 'otc': true,
83
84
  'setLeverage': false,
84
85
  'setMarginMode': false,
85
86
  'transfer': false,
@@ -102,6 +103,7 @@ export default class raastin extends Exchange {
102
103
  'api/v1/market/symbols': 1,
103
104
  'api/v1/market/symbols/{symbol}/': 1,
104
105
  'api/v1/market/depth/{symbol}': 1,
106
+ 'api/v1/market': 1,
105
107
  },
106
108
  },
107
109
  },
@@ -123,10 +125,24 @@ export default class raastin extends Exchange {
123
125
  * @param {object} [params] extra parameters specific to the exchange API endpoint
124
126
  * @returns {object[]} an array of objects representing market data
125
127
  */
128
+ const result = [];
129
+ const marketType = this.safeString(params, 'type', 'spot');
130
+ if (marketType === 'otc') {
131
+ const qoutes = ['irt', 'usdt'];
132
+ for (let i = 0; i < qoutes.length; i++) {
133
+ const quote = qoutes[i];
134
+ const OTCmarkets = await this.publicGetApiV1Market(this.extend(params, { 'quote': quote }));
135
+ for (let j = 0; j < OTCmarkets.length; j++) {
136
+ OTCmarkets[j]['quote'] = quote;
137
+ const market = this.parseOtcMarket(OTCmarkets[j]);
138
+ result.push(market);
139
+ }
140
+ }
141
+ return result;
142
+ }
126
143
  const response = await this.publicGetApiV1MarketSymbols(params);
127
144
  // Response is a flat array, not nested in 'result'
128
145
  const markets = response;
129
- const result = [];
130
146
  for (let i = 0; i < markets.length; i++) {
131
147
  const market = this.parseMarket(markets[i]);
132
148
  result.push(market);
@@ -241,6 +257,68 @@ export default class raastin extends Exchange {
241
257
  'info': market,
242
258
  };
243
259
  }
260
+ parseOtcMarket(market) {
261
+ // {
262
+ // symbol: "USDT",
263
+ // ask: "1",
264
+ // bid: "1",
265
+ // name: "tether"
266
+ // },
267
+ const baseSymbol = this.safeString(market, 'symbol');
268
+ const base = this.safeCurrencyCode(baseSymbol.toUpperCase());
269
+ const quote = this.safeCurrencyCode(market['quote'].toUpperCase());
270
+ const id = base.toUpperCase() + quote.toUpperCase();
271
+ const enabled = true;
272
+ return {
273
+ 'id': id,
274
+ 'symbol': base + '/' + quote,
275
+ 'base': base,
276
+ 'quote': quote,
277
+ 'settle': undefined,
278
+ 'baseId': base,
279
+ 'quoteId': quote,
280
+ 'settleId': undefined,
281
+ 'type': 'otc',
282
+ 'spot': false,
283
+ 'margin': false,
284
+ 'swap': false,
285
+ 'future': false,
286
+ 'option': false,
287
+ 'active': enabled,
288
+ 'contract': false,
289
+ 'linear': undefined,
290
+ 'inverse': undefined,
291
+ 'contractSize': undefined,
292
+ 'expiry': undefined,
293
+ 'expiryDatetime': undefined,
294
+ 'strike': undefined,
295
+ 'optionType': undefined,
296
+ 'precision': {
297
+ 'amount': undefined,
298
+ 'price': undefined,
299
+ },
300
+ 'limits': {
301
+ 'leverage': {
302
+ 'min': undefined,
303
+ 'max': undefined,
304
+ },
305
+ 'amount': {
306
+ 'min': undefined,
307
+ 'max': undefined,
308
+ },
309
+ 'price': {
310
+ 'min': undefined,
311
+ 'max': undefined,
312
+ },
313
+ 'cost': {
314
+ 'min': undefined,
315
+ 'max': undefined,
316
+ },
317
+ },
318
+ 'created': undefined,
319
+ 'info': market,
320
+ };
321
+ }
244
322
  async fetchTickers(symbols = undefined, params = {}) {
245
323
  /**
246
324
  * @method
@@ -250,13 +328,27 @@ export default class raastin extends Exchange {
250
328
  * @param {object} [params] extra parameters specific to the exchange API endpoint
251
329
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
252
330
  */
253
- await this.loadMarkets();
331
+ const marketType = this.safeString(params, 'type', 'spot');
332
+ await this.loadMarkets(false, { 'type': marketType });
254
333
  if (symbols !== undefined) {
255
334
  symbols = this.marketSymbols(symbols);
256
335
  }
257
- const response = await this.publicGetApiV1MarketSymbols(params);
258
- const markets = this.safeList(response, response);
259
336
  const result = {};
337
+ if (marketType === 'otc') {
338
+ const qoutes = ['irt', 'usdt'];
339
+ for (let i = 0; i < qoutes.length; i++) {
340
+ const quote = qoutes[i];
341
+ const OTCmarkets = await this.publicGetApiV1Market(this.extend(params, { 'quote': quote }));
342
+ for (let j = 0; j < OTCmarkets.length; j++) {
343
+ OTCmarkets[j]['quote'] = quote.toUpperCase();
344
+ const ticker = await this.parseOTCTicker(OTCmarkets[j]);
345
+ const symbol = ticker['symbol'];
346
+ result[symbol] = ticker;
347
+ }
348
+ }
349
+ return this.filterByArrayTickers(result, 'symbol', symbols);
350
+ }
351
+ const markets = await this.publicGetApiV1MarketSymbols(params);
260
352
  for (let i = 0; i < markets.length; i++) {
261
353
  const marketData = markets[i];
262
354
  const ticker = this.parseTicker(marketData);
@@ -274,7 +366,12 @@ export default class raastin extends Exchange {
274
366
  * @param {object} [params] extra parameters specific to the exchange API endpoint
275
367
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
276
368
  */
277
- await this.loadMarkets();
369
+ const marketType = this.safeString(params, 'type', 'spot');
370
+ await this.loadMarkets(false, { 'type': marketType });
371
+ if (marketType === 'otc') {
372
+ const tickers = await this.fetchTickers([symbol], { 'type': 'otc' });
373
+ return tickers[symbol];
374
+ }
278
375
  const market = this.market(symbol);
279
376
  const request = {
280
377
  'symbol': market['id'],
@@ -290,36 +387,61 @@ export default class raastin extends Exchange {
290
387
  const symbol = this.safeSymbol(marketId, market, undefined, marketType);
291
388
  // Since the exact ticker fields are not provided in the user's example,
292
389
  // we'll set up the basic structure. These may need adjustment based on actual API response.
293
- const last = this.safeFloat(ticker, 'last_price', 0);
294
- const high = this.safeFloat(ticker, '24h_high', 0);
295
- const low = this.safeFloat(ticker, '24h_low', 0);
296
- const baseVolume = this.safeFloat(ticker, '24h_volume', 0);
297
- const quoteVolume = this.safeFloat(ticker, '24h_quote_volume', 0);
298
- const bid = this.safeFloat(ticker, 'bid_price', 0);
299
- const ask = this.safeFloat(ticker, 'ask_price', 0);
390
+ const last = this.safeFloat(ticker, 'price', 0);
391
+ const high = this.safeFloat(ticker, 'high', 0);
392
+ const low = this.safeFloat(ticker, 'low', 0);
393
+ const baseVolume = this.safeFloat(ticker, 'base_volume', 0);
394
+ const quoteVolume = this.safeFloat(ticker, 'volume', 0);
395
+ const changePercentage = this.safeFloat(ticker, 'change_percentage', 0);
300
396
  return this.safeTicker({
301
397
  'symbol': symbol,
302
398
  'timestamp': undefined,
303
399
  'datetime': undefined,
304
400
  'high': high,
305
401
  'low': low,
306
- 'bid': bid,
402
+ 'bid': undefined,
307
403
  'bidVolume': undefined,
308
- 'ask': ask,
404
+ 'ask': undefined,
309
405
  'askVolume': undefined,
310
406
  'vwap': undefined,
311
407
  'open': undefined,
312
408
  'close': last,
313
409
  'last': last,
314
410
  'previousClose': undefined,
315
- 'change': undefined,
316
- 'percentage': undefined,
411
+ 'change': changePercentage,
412
+ 'percentage': changePercentage,
317
413
  'average': undefined,
318
414
  'baseVolume': baseVolume,
319
415
  'quoteVolume': quoteVolume,
320
416
  'info': ticker,
321
417
  }, market);
322
418
  }
419
+ parseOTCTicker(ticker, market = undefined) {
420
+ const symbol = this.safeString(ticker, 'symbol') + '/' + this.safeString(ticker, 'quote');
421
+ const bid = this.safeFloat(ticker, 'bid');
422
+ const ask = this.safeFloat(ticker, 'ask');
423
+ return this.safeTicker({
424
+ 'symbol': symbol,
425
+ 'timestamp': undefined,
426
+ 'datetime': undefined,
427
+ 'high': undefined,
428
+ 'low': undefined,
429
+ 'bid': bid,
430
+ 'bidVolume': undefined,
431
+ 'ask': ask,
432
+ 'askVolume': undefined,
433
+ 'vwap': undefined,
434
+ 'open': undefined,
435
+ 'close': undefined,
436
+ 'previousClose': undefined,
437
+ 'change': undefined,
438
+ 'percentage': undefined,
439
+ 'average': undefined,
440
+ 'baseVolume': undefined,
441
+ 'quoteVolume': undefined,
442
+ 'info': ticker,
443
+ }, market);
444
+ }
323
445
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
324
446
  /**
325
447
  * @method
@@ -360,6 +482,12 @@ export default class raastin extends Exchange {
360
482
  if (Object.keys(query).length) {
361
483
  url = url + '?' + this.urlencode(query);
362
484
  }
485
+ if (path === 'api/v1/market') {
486
+ const quote = this.safeString(params, 'quote');
487
+ if (quote !== undefined) {
488
+ url = this.urls['api']['public'] + '/' + path + '/' + quote + '/info';
489
+ }
490
+ }
363
491
  headers = { 'Content-Type': 'application/json' };
364
492
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
365
493
  }