ccxt-ir 4.9.4 → 4.9.12
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 +157 -164
- package/dist/ccxt.browser.min.js +4 -4
- package/dist/cjs/ccxt.js +22 -1
- package/dist/cjs/src/abantether.js +88 -69
- package/dist/cjs/src/abstract/bitbarg.js +11 -0
- package/dist/cjs/src/abstract/bydfi.js +11 -0
- package/dist/cjs/src/abstract/cafearz.js +11 -0
- package/dist/cjs/src/abstract/kifpoolme.js +11 -0
- package/dist/cjs/src/abstract/mazdax.js +11 -0
- package/dist/cjs/src/abstract/pingi.js +11 -0
- package/dist/cjs/src/abstract/pooleno.js +11 -0
- package/dist/cjs/src/afratether.js +84 -36
- package/dist/cjs/src/arzplus.js +32 -15
- package/dist/cjs/src/bitbarg.js +313 -0
- package/dist/cjs/src/bydfi.js +435 -0
- package/dist/cjs/src/cafearz.js +347 -0
- package/dist/cjs/src/hamtapay.js +3 -2
- package/dist/cjs/src/kifpoolme.js +411 -0
- package/dist/cjs/src/mazdax.js +536 -0
- package/dist/cjs/src/pingi.js +448 -0
- package/dist/cjs/src/pooleno.js +348 -0
- package/dist/cjs/src/tetherland.js +5 -5
- package/dist/cjs/src/twox.js +56 -29
- package/js/ccxt.d.ts +23 -2
- package/js/ccxt.js +16 -2
- package/js/src/abantether.js +88 -69
- package/js/src/abstract/abantether.d.ts +1 -1
- package/js/src/abstract/bitbarg.d.ts +8 -0
- package/js/src/abstract/bitbarg.js +11 -0
- package/js/src/abstract/bydfi.d.ts +11 -0
- package/js/src/abstract/bydfi.js +11 -0
- package/js/src/abstract/cafearz.d.ts +8 -0
- package/js/src/abstract/cafearz.js +11 -0
- package/js/src/abstract/kifpoolme.d.ts +9 -0
- package/js/src/abstract/kifpoolme.js +11 -0
- package/js/src/abstract/mazdax.d.ts +11 -0
- package/js/src/abstract/mazdax.js +11 -0
- package/js/src/abstract/pingi.d.ts +9 -0
- package/js/src/abstract/pingi.js +11 -0
- package/js/src/abstract/pooleno.d.ts +8 -0
- package/js/src/abstract/pooleno.js +11 -0
- package/js/src/afratether.js +84 -36
- package/js/src/arzplus.d.ts +3 -2
- package/js/src/arzplus.js +32 -15
- package/js/src/bitbarg.d.ts +21 -0
- package/js/src/bitbarg.js +312 -0
- package/js/src/bydfi.d.ts +23 -0
- package/js/src/bydfi.js +434 -0
- package/js/src/cafearz.d.ts +21 -0
- package/js/src/cafearz.js +346 -0
- package/js/src/hamtapay.js +3 -2
- package/js/src/kifpoolme.d.ts +23 -0
- package/js/src/kifpoolme.js +410 -0
- package/js/src/mazdax.d.ts +23 -0
- package/js/src/mazdax.js +535 -0
- package/js/src/pingi.d.ts +22 -0
- package/js/src/pingi.js +447 -0
- package/js/src/pooleno.d.ts +21 -0
- package/js/src/pooleno.js +347 -0
- package/js/src/tetherland.js +5 -5
- package/js/src/twox.js +56 -29
- package/package.json +1 -1
|
@@ -0,0 +1,347 @@
|
|
|
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/pooleno.js';
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
/**
|
|
11
|
+
* @class pooleno
|
|
12
|
+
* @augments Exchange
|
|
13
|
+
* @description Set rateLimit to 1000 if fully verified
|
|
14
|
+
*/
|
|
15
|
+
export default class pooleno extends Exchange {
|
|
16
|
+
describe() {
|
|
17
|
+
return this.deepExtend(super.describe(), {
|
|
18
|
+
'id': 'pooleno',
|
|
19
|
+
'name': 'Pooleno',
|
|
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': 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': '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/pooleno/64x64.png',
|
|
91
|
+
'api': {
|
|
92
|
+
'public': 'https://api-beta.pooleno.ir',
|
|
93
|
+
},
|
|
94
|
+
'www': 'https://pooleno.ir',
|
|
95
|
+
'doc': [
|
|
96
|
+
'https://pooleno.ir',
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
'api': {
|
|
100
|
+
'public': {
|
|
101
|
+
'get': {
|
|
102
|
+
'api/v1/tokens/public': 1,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
'fees': {
|
|
107
|
+
'trading': {
|
|
108
|
+
'tierBased': false,
|
|
109
|
+
'percentage': true,
|
|
110
|
+
'maker': this.parseNumber('0.001'),
|
|
111
|
+
'taker': this.parseNumber('0.001'),
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
async fetchMarkets(params = {}) {
|
|
117
|
+
/**
|
|
118
|
+
* @method
|
|
119
|
+
* @name pooleno#fetchMarkets
|
|
120
|
+
* @description retrieves data on all markets for pooleno
|
|
121
|
+
* @see https://api-beta.pooleno.ir/api/v1/tokens/public
|
|
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.publicGetApiV1TokensPublic(params);
|
|
126
|
+
const payload = this.safeList(response, 'payload', []);
|
|
127
|
+
const result = [];
|
|
128
|
+
for (let i = 0; i < payload.length; i++) {
|
|
129
|
+
const token = payload[i];
|
|
130
|
+
const baseAsset = this.safeString(token, 'baseAsset');
|
|
131
|
+
const quoteAsset = this.safeString(token, 'quoteAsset');
|
|
132
|
+
// Skip if base equals quote
|
|
133
|
+
if (baseAsset === quoteAsset) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
const market = this.parseMarket(token);
|
|
137
|
+
result.push(market);
|
|
138
|
+
}
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
parseMarket(market) {
|
|
142
|
+
// {
|
|
143
|
+
// "baseAsset": "USDT",
|
|
144
|
+
// "quoteAsset": "TMN",
|
|
145
|
+
// "symbolName": "USDT",
|
|
146
|
+
// "longEnName": "Tether",
|
|
147
|
+
// "longFaName": "تتر",
|
|
148
|
+
// "createdAt": "2025-02-25T13:47:27.102Z",
|
|
149
|
+
// "id": "cm43t74jo00000hrm8tw9aspo",
|
|
150
|
+
// "price": "1",
|
|
151
|
+
// "priceTMN": "112950",
|
|
152
|
+
// "sparkline": {
|
|
153
|
+
// "data": [...],
|
|
154
|
+
// "change": -538,
|
|
155
|
+
// "percentage": -0.48,
|
|
156
|
+
// "isPositive": false
|
|
157
|
+
// },
|
|
158
|
+
// "market": {
|
|
159
|
+
// "totalSupply": null,
|
|
160
|
+
// "maxSupply": null,
|
|
161
|
+
// "circulatingSupply": null,
|
|
162
|
+
// "volume24hBase": null,
|
|
163
|
+
// "high24h": null,
|
|
164
|
+
// "low24h": null,
|
|
165
|
+
// "volume24h": null,
|
|
166
|
+
// "marketCap": null
|
|
167
|
+
// },
|
|
168
|
+
// "blockchains": [...]
|
|
169
|
+
// }
|
|
170
|
+
let baseId = this.safeString(market, 'baseAsset');
|
|
171
|
+
let quoteId = this.safeString(market, 'quoteAsset');
|
|
172
|
+
const base = this.safeCurrencyCode(baseId);
|
|
173
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
174
|
+
const id = base + quote;
|
|
175
|
+
baseId = baseId.toLowerCase();
|
|
176
|
+
quoteId = quoteId.toLowerCase();
|
|
177
|
+
return {
|
|
178
|
+
'id': id,
|
|
179
|
+
'symbol': base + '/' + quote,
|
|
180
|
+
'base': base,
|
|
181
|
+
'quote': quote,
|
|
182
|
+
'settle': undefined,
|
|
183
|
+
'baseId': baseId,
|
|
184
|
+
'quoteId': quoteId,
|
|
185
|
+
'settleId': undefined,
|
|
186
|
+
'type': 'spot',
|
|
187
|
+
'spot': true,
|
|
188
|
+
'margin': false,
|
|
189
|
+
'swap': false,
|
|
190
|
+
'future': false,
|
|
191
|
+
'option': false,
|
|
192
|
+
'active': true,
|
|
193
|
+
'contract': false,
|
|
194
|
+
'linear': undefined,
|
|
195
|
+
'inverse': undefined,
|
|
196
|
+
'contractSize': undefined,
|
|
197
|
+
'expiry': undefined,
|
|
198
|
+
'expiryDatetime': undefined,
|
|
199
|
+
'strike': undefined,
|
|
200
|
+
'optionType': undefined,
|
|
201
|
+
'precision': {
|
|
202
|
+
'amount': undefined,
|
|
203
|
+
'price': undefined,
|
|
204
|
+
},
|
|
205
|
+
'limits': {
|
|
206
|
+
'leverage': {
|
|
207
|
+
'min': undefined,
|
|
208
|
+
'max': undefined,
|
|
209
|
+
},
|
|
210
|
+
'amount': {
|
|
211
|
+
'min': undefined,
|
|
212
|
+
'max': undefined,
|
|
213
|
+
},
|
|
214
|
+
'price': {
|
|
215
|
+
'min': undefined,
|
|
216
|
+
'max': undefined,
|
|
217
|
+
},
|
|
218
|
+
'cost': {
|
|
219
|
+
'min': undefined,
|
|
220
|
+
'max': undefined,
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
'created': undefined,
|
|
224
|
+
'info': market,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
async fetchTickers(symbols = undefined, params = {}) {
|
|
228
|
+
/**
|
|
229
|
+
* @method
|
|
230
|
+
* @name pooleno#fetchTickers
|
|
231
|
+
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
232
|
+
* @see https://api-beta.pooleno.ir/api/v1/tokens/public
|
|
233
|
+
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
234
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
235
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
236
|
+
*/
|
|
237
|
+
await this.loadMarkets();
|
|
238
|
+
if (symbols !== undefined) {
|
|
239
|
+
symbols = this.marketSymbols(symbols);
|
|
240
|
+
}
|
|
241
|
+
const response = await this.publicGetApiV1TokensPublic(params);
|
|
242
|
+
const payload = this.safeList(response, 'payload', []);
|
|
243
|
+
const result = {};
|
|
244
|
+
for (let i = 0; i < payload.length; i++) {
|
|
245
|
+
const token = payload[i];
|
|
246
|
+
const ticker = this.parseTicker(token);
|
|
247
|
+
const symbol = ticker['symbol'];
|
|
248
|
+
result[symbol] = ticker;
|
|
249
|
+
}
|
|
250
|
+
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
251
|
+
}
|
|
252
|
+
async fetchTicker(symbol, params = {}) {
|
|
253
|
+
/**
|
|
254
|
+
* @method
|
|
255
|
+
* @name pooleno#fetchTicker
|
|
256
|
+
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
257
|
+
* @see https://api-beta.pooleno.ir/api/v1/tokens/public
|
|
258
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
259
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
260
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
261
|
+
*/
|
|
262
|
+
const ticker = await this.fetchTickers([symbol]);
|
|
263
|
+
return ticker[symbol];
|
|
264
|
+
}
|
|
265
|
+
parseTicker(ticker, market = undefined) {
|
|
266
|
+
// {
|
|
267
|
+
// "baseAsset": "BTC",
|
|
268
|
+
// "quoteAsset": "USDT",
|
|
269
|
+
// "symbolName": "BTC",
|
|
270
|
+
// "longEnName": "Bitcoin",
|
|
271
|
+
// "longFaName": "بیتکوین",
|
|
272
|
+
// "createdAt": "2025-02-25T13:47:27.103Z",
|
|
273
|
+
// "id": "cm43t74jp00010hrmed9i7l76",
|
|
274
|
+
// "price": "115024.7",
|
|
275
|
+
// "priceTMN": "12980537395",
|
|
276
|
+
// "sparkline": {
|
|
277
|
+
// "data": [...],
|
|
278
|
+
// "change": -538,
|
|
279
|
+
// "percentage": -0.48,
|
|
280
|
+
// "isPositive": false
|
|
281
|
+
// },
|
|
282
|
+
// "market": {
|
|
283
|
+
// "totalSupply": null,
|
|
284
|
+
// "maxSupply": null,
|
|
285
|
+
// "circulatingSupply": null,
|
|
286
|
+
// "volume24hBase": null,
|
|
287
|
+
// "high24h": null,
|
|
288
|
+
// "low24h": null,
|
|
289
|
+
// "volume24h": null,
|
|
290
|
+
// "marketCap": null
|
|
291
|
+
// },
|
|
292
|
+
// "blockchains": [...]
|
|
293
|
+
// }
|
|
294
|
+
const marketType = 'spot';
|
|
295
|
+
const baseAsset = this.safeString(ticker, 'baseAsset');
|
|
296
|
+
const quoteAsset = this.safeString(ticker, 'quoteAsset');
|
|
297
|
+
const marketId = baseAsset + '/' + quoteAsset;
|
|
298
|
+
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
299
|
+
const price = this.safeFloat(ticker, 'price');
|
|
300
|
+
const priceTMN = this.safeFloat(ticker, 'priceTMN');
|
|
301
|
+
const sparkline = this.safeDict(ticker, 'sparkline', {});
|
|
302
|
+
const change = this.safeFloat(sparkline, 'change');
|
|
303
|
+
const percentage = this.safeFloat(sparkline, 'percentage');
|
|
304
|
+
const marketData = this.safeDict(ticker, 'market', {});
|
|
305
|
+
const high24h = this.safeFloat(marketData, 'high24h');
|
|
306
|
+
const low24h = this.safeFloat(marketData, 'low24h');
|
|
307
|
+
const volume24h = this.safeFloat(marketData, 'volume24h');
|
|
308
|
+
let last = undefined;
|
|
309
|
+
let baseVolume = undefined;
|
|
310
|
+
if (quoteAsset === 'TMN' || quoteAsset === 'IRT') {
|
|
311
|
+
// For TMN/IRT pairs, use priceTMN
|
|
312
|
+
last = priceTMN;
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
// For other pairs (like USDT), use price
|
|
316
|
+
last = price;
|
|
317
|
+
baseVolume = volume24h;
|
|
318
|
+
}
|
|
319
|
+
return this.safeTicker({
|
|
320
|
+
'symbol': symbol,
|
|
321
|
+
'timestamp': undefined,
|
|
322
|
+
'datetime': undefined,
|
|
323
|
+
'high': high24h,
|
|
324
|
+
'low': low24h,
|
|
325
|
+
'bid': last,
|
|
326
|
+
'bidVolume': undefined,
|
|
327
|
+
'ask': last,
|
|
328
|
+
'askVolume': undefined,
|
|
329
|
+
'vwap': undefined,
|
|
330
|
+
'open': undefined,
|
|
331
|
+
'close': last,
|
|
332
|
+
'last': last,
|
|
333
|
+
'previousClose': undefined,
|
|
334
|
+
'change': change,
|
|
335
|
+
'percentage': percentage,
|
|
336
|
+
'average': undefined,
|
|
337
|
+
'baseVolume': baseVolume,
|
|
338
|
+
'quoteVolume': undefined,
|
|
339
|
+
'info': ticker,
|
|
340
|
+
}, market);
|
|
341
|
+
}
|
|
342
|
+
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
343
|
+
const url = this.urls['api']['public'] + '/' + path;
|
|
344
|
+
headers = { 'Content-Type': 'application/json' };
|
|
345
|
+
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
346
|
+
}
|
|
347
|
+
}
|
package/js/src/tetherland.js
CHANGED
|
@@ -89,7 +89,7 @@ export default class tetherland extends Exchange {
|
|
|
89
89
|
'urls': {
|
|
90
90
|
'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/tetherland/64x64.png',
|
|
91
91
|
'api': {
|
|
92
|
-
'public': 'https://
|
|
92
|
+
'public': 'https://service.tetherland.com',
|
|
93
93
|
},
|
|
94
94
|
'www': 'https://tetherland.org',
|
|
95
95
|
'doc': [
|
|
@@ -123,7 +123,7 @@ export default class tetherland extends Exchange {
|
|
|
123
123
|
* @returns {object[]} an array of objects representing market data
|
|
124
124
|
*/
|
|
125
125
|
const response = await this.publicGetApiV5Currencies(params);
|
|
126
|
-
const markets = this.
|
|
126
|
+
const markets = this.safeList(response, 'data');
|
|
127
127
|
const result = [];
|
|
128
128
|
const quotes = ['USDT', 'IRT'];
|
|
129
129
|
for (let i = 0; i < markets.length; i++) {
|
|
@@ -253,8 +253,8 @@ export default class tetherland extends Exchange {
|
|
|
253
253
|
symbols = this.marketSymbols(symbols);
|
|
254
254
|
}
|
|
255
255
|
const response = await this.publicGetApiV5Currencies(params);
|
|
256
|
-
const markets = this.
|
|
257
|
-
const result =
|
|
256
|
+
const markets = this.safeList(response, 'data');
|
|
257
|
+
const result = {};
|
|
258
258
|
const quotes = ['USDT', 'IRT'];
|
|
259
259
|
for (let i = 0; i < markets.length; i++) {
|
|
260
260
|
for (let key = 0; key < quotes.length; key++) {
|
|
@@ -331,7 +331,7 @@ export default class tetherland extends Exchange {
|
|
|
331
331
|
const marketId = this.safeString(ticker, 'id');
|
|
332
332
|
const quote = this.safeString(ticker, 'quote');
|
|
333
333
|
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
334
|
-
let last = this.
|
|
334
|
+
let last = parseFloat(this.safeString(ticker, 'price', '').replace(',', ''));
|
|
335
335
|
if (quote === 'IRT') {
|
|
336
336
|
last = this.safeFloat(ticker, 'toman_amount', 0);
|
|
337
337
|
}
|
package/js/src/twox.js
CHANGED
|
@@ -24,7 +24,7 @@ export default class twox extends Exchange {
|
|
|
24
24
|
'pro': false,
|
|
25
25
|
'has': {
|
|
26
26
|
'CORS': undefined,
|
|
27
|
-
'spot':
|
|
27
|
+
'spot': false,
|
|
28
28
|
'margin': false,
|
|
29
29
|
'swap': false,
|
|
30
30
|
'future': false,
|
|
@@ -80,6 +80,7 @@ export default class twox 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,
|
|
@@ -243,7 +244,7 @@ export default class twox extends Exchange {
|
|
|
243
244
|
symbols = this.marketSymbols(symbols);
|
|
244
245
|
}
|
|
245
246
|
const response = await this.publicGetApiCurrencies(params);
|
|
246
|
-
const result =
|
|
247
|
+
const result = {};
|
|
247
248
|
const quotes = ['IRT', 'USDT'];
|
|
248
249
|
for (let i = 0; i < response.length; i++) {
|
|
249
250
|
const base = this.safeString(response[i], 'symbol');
|
|
@@ -277,51 +278,77 @@ export default class twox extends Exchange {
|
|
|
277
278
|
}
|
|
278
279
|
parseTicker(ticker, market = undefined) {
|
|
279
280
|
// {
|
|
280
|
-
// sellPrice: 0,
|
|
281
|
-
// buyPrice: 0,
|
|
282
|
-
// latestPrice: 0,
|
|
283
|
-
// weeklyChart: "https://cdn.twox.
|
|
284
|
-
// priceChangePercent: 0,
|
|
285
|
-
//
|
|
281
|
+
// sellPrice: 113201.0,
|
|
282
|
+
// buyPrice: 112151.0,
|
|
283
|
+
// latestPrice: 1.0,
|
|
284
|
+
// weeklyChart: "https://cdn.twox.info/resource/w/tether.webp?v=101313",
|
|
285
|
+
// priceChangePercent: 0.0,
|
|
286
|
+
// sellPriceChange: 0.00,
|
|
287
|
+
// buyPriceChange: 0.00,
|
|
288
|
+
// minAmount: 2.0,
|
|
286
289
|
// tags: [ ],
|
|
287
290
|
// marketCategories: [ ],
|
|
288
|
-
// id:
|
|
289
|
-
// symbol: "
|
|
290
|
-
// name: "
|
|
291
|
-
// icon: "https://cdn.twox.
|
|
292
|
-
// persianName: "
|
|
293
|
-
// isStableCoin:
|
|
291
|
+
// id: 2,
|
|
292
|
+
// symbol: "USDT",
|
|
293
|
+
// name: "Tether USDt",
|
|
294
|
+
// icon: "https://cdn.twox.info/resource/c/tether.webp",
|
|
295
|
+
// persianName: "تتر",
|
|
296
|
+
// isStableCoin: true,
|
|
294
297
|
// isActive: true,
|
|
295
|
-
//
|
|
296
|
-
// type: 0,
|
|
298
|
+
// type: 2,
|
|
297
299
|
// isNeedRiskWarning: false,
|
|
298
|
-
// assetPrecision:
|
|
299
|
-
// isLeveragedToken: false,
|
|
300
|
-
// commissionPrecision: 0,
|
|
300
|
+
// assetPrecision: 2,
|
|
301
301
|
// isDepositAllEnable: true,
|
|
302
|
-
//
|
|
302
|
+
// tradeStatus: 1,
|
|
303
303
|
// isWithdrawAllEnable: true,
|
|
304
|
-
// currencySlug: "
|
|
305
|
-
// marketCurrencyId:
|
|
306
|
-
// order:
|
|
304
|
+
// currencySlug: "tether",
|
|
305
|
+
// marketCurrencyId: 825,
|
|
306
|
+
// order: 1,
|
|
307
|
+
// isTrading: true,
|
|
308
|
+
// commissionPrecision: 8,
|
|
309
|
+
// isDepositNeedManualConfirm: false,
|
|
310
|
+
// supportedBy: [ ]
|
|
307
311
|
// },
|
|
308
312
|
const marketType = 'otc';
|
|
309
313
|
const marketId = this.safeString(ticker, 'symbol');
|
|
310
314
|
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
311
|
-
|
|
315
|
+
const sellPrice = this.safeFloat(ticker, 'sellPrice');
|
|
316
|
+
const buyPrice = this.safeFloat(ticker, 'buyPrice');
|
|
317
|
+
const latestPrice = this.safeFloat(ticker, 'latestPrice');
|
|
318
|
+
let last = undefined;
|
|
319
|
+
let bid = undefined;
|
|
320
|
+
let ask = undefined;
|
|
321
|
+
if (ticker['quote'] === 'IRT') {
|
|
322
|
+
// For IRT pairs, sellPrice is what user pays (ask), buyPrice is what user receives (bid)
|
|
323
|
+
last = sellPrice;
|
|
324
|
+
bid = buyPrice;
|
|
325
|
+
ask = sellPrice;
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
// For USDT pairs, use latestPrice
|
|
329
|
+
last = latestPrice;
|
|
330
|
+
bid = buyPrice;
|
|
331
|
+
ask = sellPrice;
|
|
332
|
+
}
|
|
333
|
+
const percentage = this.safeFloat(ticker, 'priceChangePercent');
|
|
334
|
+
const sellPriceChange = this.safeFloat(ticker, 'sellPriceChange');
|
|
335
|
+
const buyPriceChange = this.safeFloat(ticker, 'buyPriceChange');
|
|
336
|
+
let change = undefined;
|
|
312
337
|
if (ticker['quote'] === 'IRT') {
|
|
313
|
-
|
|
338
|
+
change = sellPriceChange;
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
change = buyPriceChange;
|
|
314
342
|
}
|
|
315
|
-
const change = this.safeFloat(ticker, 'priceChangePercent', 0);
|
|
316
343
|
return this.safeTicker({
|
|
317
344
|
'symbol': symbol,
|
|
318
345
|
'timestamp': undefined,
|
|
319
346
|
'datetime': undefined,
|
|
320
347
|
'high': undefined,
|
|
321
348
|
'low': undefined,
|
|
322
|
-
'bid':
|
|
349
|
+
'bid': bid,
|
|
323
350
|
'bidVolume': undefined,
|
|
324
|
-
'ask':
|
|
351
|
+
'ask': ask,
|
|
325
352
|
'askVolume': undefined,
|
|
326
353
|
'vwap': undefined,
|
|
327
354
|
'open': undefined,
|
|
@@ -329,7 +356,7 @@ export default class twox extends Exchange {
|
|
|
329
356
|
'last': last,
|
|
330
357
|
'previousClose': undefined,
|
|
331
358
|
'change': change,
|
|
332
|
-
'percentage':
|
|
359
|
+
'percentage': percentage,
|
|
333
360
|
'average': undefined,
|
|
334
361
|
'baseVolume': undefined,
|
|
335
362
|
'quoteVolume': undefined,
|
package/package.json
CHANGED