ccxt-ir 4.9.0 → 4.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +4 -1
- package/dist/cjs/src/abstract/hamtapay.js +11 -0
- package/dist/cjs/src/arzplus.js +132 -4
- package/dist/cjs/src/hamtapay.js +300 -0
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- package/js/src/abstract/arzplus.d.ts +1 -0
- package/js/src/abstract/hamtapay.d.ts +9 -0
- package/js/src/abstract/hamtapay.js +11 -0
- package/js/src/arzplus.d.ts +2 -0
- package/js/src/arzplus.js +132 -4
- package/js/src/base/Exchange.d.ts +2 -2
- package/js/src/base/types.d.ts +1 -1
- package/js/src/coinbaseexchange.d.ts +1 -1
- package/js/src/hamtapay.d.ts +21 -0
- package/js/src/hamtapay.js +299 -0
- package/js/src/protobuf/mexc/compiled.d.cts +6 -0
- package/js/src/static_dependencies/fflake/browser.d.ts +5 -5
- package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.d.ts +2 -2
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/js/src/static_dependencies/qs/formats.d.cts +6 -0
- package/js/src/static_dependencies/qs/index.d.cts +6 -0
- package/js/src/static_dependencies/qs/parse.d.cts +6 -0
- package/js/src/static_dependencies/qs/stringify.d.cts +6 -0
- package/js/src/static_dependencies/qs/utils.d.cts +6 -0
- package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
- package/package.json +1 -1
package/js/src/arzplus.d.ts
CHANGED
|
@@ -9,9 +9,11 @@ export default class arzplus extends Exchange {
|
|
|
9
9
|
describe(): any;
|
|
10
10
|
fetchMarkets(params?: {}): Promise<Market[]>;
|
|
11
11
|
parseMarket(market: any): Market;
|
|
12
|
+
parseOTCMarkets(market: any): 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
|
fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
16
18
|
fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
17
19
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
package/js/src/arzplus.js
CHANGED
|
@@ -105,6 +105,7 @@ export default class arzplus extends Exchange {
|
|
|
105
105
|
'api/v1/market/symbols': 1,
|
|
106
106
|
'api/v1/market/tradingview/ohlcv': 1,
|
|
107
107
|
'api/v1/market/depth': 1,
|
|
108
|
+
'api/v1/market/irt/info': 1,
|
|
108
109
|
},
|
|
109
110
|
},
|
|
110
111
|
},
|
|
@@ -132,11 +133,22 @@ export default class arzplus extends Exchange {
|
|
|
132
133
|
'enable': 'true',
|
|
133
134
|
};
|
|
134
135
|
const response = await this.publicGetApiV1MarketSymbols(request);
|
|
136
|
+
const otcMarkets = await this.publicGetApiV1MarketIrtInfo(request);
|
|
135
137
|
const result = [];
|
|
136
138
|
for (let i = 0; i < response.length; i++) {
|
|
137
139
|
const market = this.parseMarket(response[i]);
|
|
138
140
|
result.push(market);
|
|
139
141
|
}
|
|
142
|
+
for (let i = 0; i < otcMarkets.length; i++) {
|
|
143
|
+
const marketdata = otcMarkets[i];
|
|
144
|
+
marketdata['quote'] = 'IRT';
|
|
145
|
+
marketdata['id'] = 'OTC_' + marketdata['symbol'] + marketdata['quote'];
|
|
146
|
+
const parsedMarket = this.parseOTCMarkets(marketdata);
|
|
147
|
+
result.push(parsedMarket);
|
|
148
|
+
}
|
|
149
|
+
if (params['type']) {
|
|
150
|
+
return this.filterByArray(result, 'type', params['type'], false);
|
|
151
|
+
}
|
|
140
152
|
return result;
|
|
141
153
|
}
|
|
142
154
|
parseMarket(market) {
|
|
@@ -235,6 +247,70 @@ export default class arzplus extends Exchange {
|
|
|
235
247
|
'info': market,
|
|
236
248
|
};
|
|
237
249
|
}
|
|
250
|
+
parseOTCMarkets(market) {
|
|
251
|
+
// {
|
|
252
|
+
// symbol: "BTC",
|
|
253
|
+
// ask: "13877900000",
|
|
254
|
+
// bid: "13860999995",
|
|
255
|
+
// name: "bitcoin"
|
|
256
|
+
// },
|
|
257
|
+
const baseAsset = this.safeString(market, 'symbol');
|
|
258
|
+
const quoteAsset = this.safeString(market, 'quote');
|
|
259
|
+
const baseId = baseAsset;
|
|
260
|
+
const quoteId = quoteAsset;
|
|
261
|
+
const base = this.safeCurrencyCode(baseId);
|
|
262
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
263
|
+
const id = this.safeString(market, 'id');
|
|
264
|
+
return {
|
|
265
|
+
'id': id,
|
|
266
|
+
'symbol': base + '/' + quote,
|
|
267
|
+
'base': base,
|
|
268
|
+
'quote': quote,
|
|
269
|
+
'settle': undefined,
|
|
270
|
+
'baseId': baseId,
|
|
271
|
+
'quoteId': quoteId,
|
|
272
|
+
'settleId': undefined,
|
|
273
|
+
'type': 'otc',
|
|
274
|
+
'spot': false,
|
|
275
|
+
'margin': false,
|
|
276
|
+
'swap': false,
|
|
277
|
+
'future': false,
|
|
278
|
+
'option': false,
|
|
279
|
+
'active': true,
|
|
280
|
+
'contract': false,
|
|
281
|
+
'linear': undefined,
|
|
282
|
+
'inverse': undefined,
|
|
283
|
+
'contractSize': undefined,
|
|
284
|
+
'expiry': undefined,
|
|
285
|
+
'expiryDatetime': undefined,
|
|
286
|
+
'strike': undefined,
|
|
287
|
+
'optionType': undefined,
|
|
288
|
+
'precision': {
|
|
289
|
+
'amount': undefined,
|
|
290
|
+
'price': undefined,
|
|
291
|
+
},
|
|
292
|
+
'limits': {
|
|
293
|
+
'leverage': {
|
|
294
|
+
'min': undefined,
|
|
295
|
+
'max': undefined,
|
|
296
|
+
},
|
|
297
|
+
'amount': {
|
|
298
|
+
'min': undefined,
|
|
299
|
+
'max': undefined,
|
|
300
|
+
},
|
|
301
|
+
'price': {
|
|
302
|
+
'min': undefined,
|
|
303
|
+
'max': undefined,
|
|
304
|
+
},
|
|
305
|
+
'cost': {
|
|
306
|
+
'min': undefined,
|
|
307
|
+
'max': undefined,
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
'created': undefined,
|
|
311
|
+
'info': market,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
238
314
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
239
315
|
/**
|
|
240
316
|
* @method
|
|
@@ -249,8 +325,20 @@ export default class arzplus extends Exchange {
|
|
|
249
325
|
if (symbols !== undefined) {
|
|
250
326
|
symbols = this.marketSymbols(symbols);
|
|
251
327
|
}
|
|
252
|
-
const response = await this.publicGetApiV1MarketSymbols(params);
|
|
253
328
|
const result = {};
|
|
329
|
+
if (params['type'] === 'otc') {
|
|
330
|
+
const otcMarkets = await this.publicGetApiV1MarketIrtInfo(params);
|
|
331
|
+
for (let i = 0; i < otcMarkets.length; i++) {
|
|
332
|
+
const marketdata = otcMarkets[i];
|
|
333
|
+
marketdata['quote'] = 'IRT';
|
|
334
|
+
marketdata['id'] = 'OTC_' + marketdata['symbol'] + marketdata['quote'];
|
|
335
|
+
const parsedMarket = this.parseOTCTicker(marketdata);
|
|
336
|
+
const symbol = parsedMarket['symbol'];
|
|
337
|
+
result[symbol] = parsedMarket;
|
|
338
|
+
}
|
|
339
|
+
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
340
|
+
}
|
|
341
|
+
const response = await this.publicGetApiV1MarketSymbols(params);
|
|
254
342
|
for (let i = 0; i < response.length; i++) {
|
|
255
343
|
const request = {
|
|
256
344
|
'symbol': response[i]['name'],
|
|
@@ -350,6 +438,44 @@ export default class arzplus extends Exchange {
|
|
|
350
438
|
'info': ticker,
|
|
351
439
|
}, market);
|
|
352
440
|
}
|
|
441
|
+
parseOTCTicker(ticker, market = undefined) {
|
|
442
|
+
// {
|
|
443
|
+
// id: "BTCUSDT",
|
|
444
|
+
// symbol: "BTC",
|
|
445
|
+
// ask: "13877900000",
|
|
446
|
+
// bid: "13860999995",
|
|
447
|
+
// name: "bitcoin"
|
|
448
|
+
// quote: "IRT"
|
|
449
|
+
// }
|
|
450
|
+
const marketType = 'otc';
|
|
451
|
+
const marketId = this.safeString(ticker, 'id');
|
|
452
|
+
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
453
|
+
const bid = this.safeFloat(ticker, 'bid', 0);
|
|
454
|
+
const ask = this.safeFloat(ticker, 'ask', 0);
|
|
455
|
+
const last = this.safeFloat(ticker, 'ask', 0);
|
|
456
|
+
return this.safeTicker({
|
|
457
|
+
'symbol': symbol,
|
|
458
|
+
'timestamp': undefined,
|
|
459
|
+
'datetime': undefined,
|
|
460
|
+
'high': undefined,
|
|
461
|
+
'low': undefined,
|
|
462
|
+
'bid': bid,
|
|
463
|
+
'bidVolume': undefined,
|
|
464
|
+
'ask': ask,
|
|
465
|
+
'askVolume': undefined,
|
|
466
|
+
'vwap': undefined,
|
|
467
|
+
'open': last,
|
|
468
|
+
'close': last,
|
|
469
|
+
'last': last,
|
|
470
|
+
'previousClose': undefined,
|
|
471
|
+
'change': undefined,
|
|
472
|
+
'percentage': undefined,
|
|
473
|
+
'average': undefined,
|
|
474
|
+
'baseVolume': undefined,
|
|
475
|
+
'quoteVolume': undefined,
|
|
476
|
+
'info': ticker,
|
|
477
|
+
}, market);
|
|
478
|
+
}
|
|
353
479
|
async fetchOHLCV(symbol, timeframe = '1h', since = undefined, limit = undefined, params = {}) {
|
|
354
480
|
/**
|
|
355
481
|
* @method
|
|
@@ -421,14 +547,16 @@ export default class arzplus extends Exchange {
|
|
|
421
547
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
422
548
|
const query = this.omit(params, this.extractParams(path));
|
|
423
549
|
let url = this.urls['api']['public'] + '/' + path;
|
|
424
|
-
|
|
550
|
+
const symbol = this.safeString(params, 'symbol');
|
|
551
|
+
const stats = this.safeValue(params, 'stats');
|
|
552
|
+
if (stats !== undefined) {
|
|
425
553
|
url = url + '?' + this.urlencode(query);
|
|
426
554
|
}
|
|
427
555
|
if (path === 'api/v1/market/tradingview/ohlcv') {
|
|
428
556
|
url = url + '?' + this.urlencode(query);
|
|
429
557
|
}
|
|
430
|
-
else if (
|
|
431
|
-
url = url + '/' +
|
|
558
|
+
else if (symbol !== undefined) {
|
|
559
|
+
url = url + '/' + symbol;
|
|
432
560
|
}
|
|
433
561
|
headers = { 'Content-Type': 'application/json' };
|
|
434
562
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
@@ -252,7 +252,7 @@ export default class Exchange {
|
|
|
252
252
|
outputLen: number;
|
|
253
253
|
blockLen: number;
|
|
254
254
|
create(): import("../static_dependencies/noble-hashes/utils.js").Hash<import("../static_dependencies/noble-hashes/utils.js").Hash<any>>;
|
|
255
|
-
}, digest?: "
|
|
255
|
+
}, digest?: "hex" | "base64" | "binary") => any;
|
|
256
256
|
arrayConcat: (a: any[], b: any[]) => any[];
|
|
257
257
|
encode: (str: string) => Uint8Array;
|
|
258
258
|
urlencode: (object: object, sort?: boolean) => string;
|
|
@@ -261,7 +261,7 @@ export default class Exchange {
|
|
|
261
261
|
outputLen: number;
|
|
262
262
|
blockLen: number;
|
|
263
263
|
create(): import("../static_dependencies/noble-hashes/utils.js").Hash<import("../static_dependencies/noble-hashes/utils.js").Hash<any>>;
|
|
264
|
-
}, digest?: "
|
|
264
|
+
}, digest?: "hex" | "base64" | "binary") => any;
|
|
265
265
|
numberToString: typeof functions.numberToString;
|
|
266
266
|
parseTimeframe: (timeframe: string) => number;
|
|
267
267
|
safeInteger2: (o: any, k1: IndexType, k2: IndexType, $default?: number) => number;
|
package/js/src/base/types.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare type Bool = boolean | undefined;
|
|
|
7
7
|
export declare type IndexType = number | string;
|
|
8
8
|
export declare type OrderSide = 'buy' | 'sell' | string | undefined;
|
|
9
9
|
export declare type OrderType = 'limit' | 'market' | string;
|
|
10
|
-
export declare type MarketType = 'spot' | 'margin' | 'swap' | 'future' | 'option' | 'delivery' | 'index';
|
|
10
|
+
export declare type MarketType = 'spot' | 'margin' | 'swap' | 'future' | 'option' | 'delivery' | 'index' | 'otc';
|
|
11
11
|
export declare type SubType = 'linear' | 'inverse' | undefined;
|
|
12
12
|
export interface Dictionary<T> {
|
|
13
13
|
[key: string]: T;
|
|
@@ -311,7 +311,7 @@ export default class coinbaseexchange extends Exchange {
|
|
|
311
311
|
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
312
312
|
*/
|
|
313
313
|
fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
314
|
-
parseTransactionStatus(transaction: any): "canceled" | "pending" | "
|
|
314
|
+
parseTransactionStatus(transaction: any): "canceled" | "pending" | "ok" | "failed";
|
|
315
315
|
parseTransaction(transaction: Dict, currency?: Currency): Transaction;
|
|
316
316
|
/**
|
|
317
317
|
* @method
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Exchange from './abstract/hamtapay.js';
|
|
2
|
+
import { Market, Strings, Ticker, Tickers } from './base/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @class hamtapay
|
|
5
|
+
* @augments Exchange
|
|
6
|
+
* @description Set rateLimit to 1000 if fully verified
|
|
7
|
+
*/
|
|
8
|
+
export default class hamtapay 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,299 @@
|
|
|
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/hamtapay.js';
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
/**
|
|
11
|
+
* @class hamtapay
|
|
12
|
+
* @augments Exchange
|
|
13
|
+
* @description Set rateLimit to 1000 if fully verified
|
|
14
|
+
*/
|
|
15
|
+
export default class hamtapay extends Exchange {
|
|
16
|
+
describe() {
|
|
17
|
+
return this.deepExtend(super.describe(), {
|
|
18
|
+
'id': 'hamtapay',
|
|
19
|
+
'name': 'Hamtapay',
|
|
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/hamtapay/64x64.png',
|
|
91
|
+
'api': {
|
|
92
|
+
'public': 'https://api.hamtapay.org',
|
|
93
|
+
},
|
|
94
|
+
'www': 'https://hamtapay.net/',
|
|
95
|
+
'doc': [
|
|
96
|
+
'https://hamtapay.net/',
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
'api': {
|
|
100
|
+
'public': {
|
|
101
|
+
'get': {
|
|
102
|
+
'/financial/api/market': 1,
|
|
103
|
+
'/financial/api/vitrin/prices': 1,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
'fees': {
|
|
108
|
+
'trading': {
|
|
109
|
+
'tierBased': false,
|
|
110
|
+
'percentage': true,
|
|
111
|
+
'maker': this.parseNumber('0.001'),
|
|
112
|
+
'taker': this.parseNumber('0.001'),
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
async fetchMarkets(params = {}) {
|
|
118
|
+
/**
|
|
119
|
+
* @method
|
|
120
|
+
* @name hamtapay#fetchMarkets
|
|
121
|
+
* @description retrieves data on all markets for hamtapay
|
|
122
|
+
* @see https://api.hamtapay.org/financial/api/market
|
|
123
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
124
|
+
* @returns {object[]} an array of objects representing market data
|
|
125
|
+
*/
|
|
126
|
+
const response = await this.publicGetFinancialApiMarket(params);
|
|
127
|
+
const result = [];
|
|
128
|
+
const marketData = this.safeList(response, 'data', []);
|
|
129
|
+
for (let i = 0; i < marketData.length; i++) {
|
|
130
|
+
const market = this.parseMarket(marketData[i]);
|
|
131
|
+
result.push(market);
|
|
132
|
+
}
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
parseMarket(market) {
|
|
136
|
+
// {
|
|
137
|
+
// "symbol": "USDT-IRT",
|
|
138
|
+
// "base": "USDT",
|
|
139
|
+
// "quote": "IRT",
|
|
140
|
+
// "base_currency_decimals": 3,
|
|
141
|
+
// "quote_currency_decimals": 0,
|
|
142
|
+
// "amount_decimals": 0,
|
|
143
|
+
// "price_decimals": 0
|
|
144
|
+
// }
|
|
145
|
+
const baseId = this.safeString(market, 'base');
|
|
146
|
+
const quoteId = this.safeString(market, 'quote');
|
|
147
|
+
const base = this.safeCurrencyCode(baseId);
|
|
148
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
149
|
+
const id = this.safeString(market, 'symbol');
|
|
150
|
+
return {
|
|
151
|
+
'id': id,
|
|
152
|
+
'symbol': base + '/' + quote,
|
|
153
|
+
'base': base,
|
|
154
|
+
'quote': quote,
|
|
155
|
+
'settle': undefined,
|
|
156
|
+
'baseId': baseId,
|
|
157
|
+
'quoteId': quoteId,
|
|
158
|
+
'settleId': undefined,
|
|
159
|
+
'type': 'otc',
|
|
160
|
+
'spot': false,
|
|
161
|
+
'margin': false,
|
|
162
|
+
'swap': false,
|
|
163
|
+
'future': false,
|
|
164
|
+
'option': false,
|
|
165
|
+
'active': true,
|
|
166
|
+
'contract': false,
|
|
167
|
+
'linear': undefined,
|
|
168
|
+
'inverse': undefined,
|
|
169
|
+
'contractSize': undefined,
|
|
170
|
+
'expiry': undefined,
|
|
171
|
+
'expiryDatetime': undefined,
|
|
172
|
+
'strike': undefined,
|
|
173
|
+
'optionType': undefined,
|
|
174
|
+
'precision': {
|
|
175
|
+
'amount': undefined,
|
|
176
|
+
'price': undefined,
|
|
177
|
+
},
|
|
178
|
+
'limits': {
|
|
179
|
+
'leverage': {
|
|
180
|
+
'min': undefined,
|
|
181
|
+
'max': undefined,
|
|
182
|
+
},
|
|
183
|
+
'amount': {
|
|
184
|
+
'min': undefined,
|
|
185
|
+
'max': undefined,
|
|
186
|
+
},
|
|
187
|
+
'price': {
|
|
188
|
+
'min': undefined,
|
|
189
|
+
'max': undefined,
|
|
190
|
+
},
|
|
191
|
+
'cost': {
|
|
192
|
+
'min': undefined,
|
|
193
|
+
'max': undefined,
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
'created': undefined,
|
|
197
|
+
'info': market,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
async fetchTickers(symbols = undefined, params = {}) {
|
|
201
|
+
/**
|
|
202
|
+
* @method
|
|
203
|
+
* @name hamtapay#fetchTickers
|
|
204
|
+
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
205
|
+
* @see https://api.hamtapay.org/financial/api/vitrin/prices
|
|
206
|
+
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
207
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
208
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
209
|
+
*/
|
|
210
|
+
await this.loadMarkets();
|
|
211
|
+
if (symbols !== undefined) {
|
|
212
|
+
symbols = this.marketSymbols(symbols);
|
|
213
|
+
}
|
|
214
|
+
const response = await this.publicGetFinancialApiVitrinPrices(params);
|
|
215
|
+
const data = this.safeDict(response, 'data', {});
|
|
216
|
+
const result = {};
|
|
217
|
+
const quotes = ['IRT', 'USDT'];
|
|
218
|
+
for (let i = 0; i < quotes.length; i++) {
|
|
219
|
+
const current_qoute = quotes[i];
|
|
220
|
+
const corresponding_data = this.safeDict(data, current_qoute, {});
|
|
221
|
+
for (let j = 0; j < Object.keys(corresponding_data).length; j++) {
|
|
222
|
+
const current_base = Object.keys(corresponding_data)[j];
|
|
223
|
+
const current_ticker = corresponding_data[current_base];
|
|
224
|
+
current_ticker['base'] = current_base;
|
|
225
|
+
current_ticker['quote'] = current_qoute;
|
|
226
|
+
current_ticker['symbol'] = current_base + '/' + current_qoute;
|
|
227
|
+
current_ticker['id'] = current_base + '-' + current_qoute;
|
|
228
|
+
result[current_ticker['symbol']] = this.parseTicker(current_ticker);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
232
|
+
}
|
|
233
|
+
async fetchTicker(symbol, params = {}) {
|
|
234
|
+
/**
|
|
235
|
+
* @method
|
|
236
|
+
* @name hamtapay#fetchTicker
|
|
237
|
+
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
238
|
+
* @see https://hamtapay.com/management/all-coins/?format=json
|
|
239
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
240
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
241
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
242
|
+
*/
|
|
243
|
+
const ticker = await this.fetchTickers([symbol]);
|
|
244
|
+
return ticker[symbol];
|
|
245
|
+
}
|
|
246
|
+
parseTicker(ticker, market = undefined) {
|
|
247
|
+
// {
|
|
248
|
+
// "id": "USDT-IRT",
|
|
249
|
+
// "symbol": "USDT/IRT",
|
|
250
|
+
// "base": "USDT",
|
|
251
|
+
// "quote": "IRT",
|
|
252
|
+
// "min_price_24h": "111702",
|
|
253
|
+
// "max_price_24h": "115872",
|
|
254
|
+
// "market_price": "115942",
|
|
255
|
+
// "buy_price": "117101",
|
|
256
|
+
// "sell_price": "114782",
|
|
257
|
+
// "change_rate_24h": 3.29,
|
|
258
|
+
// "amount_decimals": 0,
|
|
259
|
+
// "price_decimals": 0,
|
|
260
|
+
// "status": "ACTIVE"
|
|
261
|
+
// }
|
|
262
|
+
const marketType = 'otc';
|
|
263
|
+
const marketId = this.safeString(ticker, 'id');
|
|
264
|
+
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
265
|
+
const last = this.safeFloat(ticker, 'buy_price', 0);
|
|
266
|
+
const change = this.safeFloat(ticker, 'change_rate_24h', 0);
|
|
267
|
+
const ask = this.safeFloat(ticker, 'buy_price', 0);
|
|
268
|
+
const bid = this.safeFloat(ticker, 'sell_price', 0);
|
|
269
|
+
const high = this.safeFloat(ticker, 'max_price_24h', 0);
|
|
270
|
+
const low = this.safeFloat(ticker, 'min_price_24h', 0);
|
|
271
|
+
return this.safeTicker({
|
|
272
|
+
'symbol': symbol,
|
|
273
|
+
'timestamp': undefined,
|
|
274
|
+
'datetime': undefined,
|
|
275
|
+
'high': high,
|
|
276
|
+
'low': low,
|
|
277
|
+
'bid': bid,
|
|
278
|
+
'bidVolume': undefined,
|
|
279
|
+
'ask': ask,
|
|
280
|
+
'askVolume': undefined,
|
|
281
|
+
'vwap': undefined,
|
|
282
|
+
'open': undefined,
|
|
283
|
+
'close': last,
|
|
284
|
+
'last': last,
|
|
285
|
+
'previousClose': undefined,
|
|
286
|
+
'change': undefined,
|
|
287
|
+
'percentage': change,
|
|
288
|
+
'average': undefined,
|
|
289
|
+
'baseVolume': undefined,
|
|
290
|
+
'quoteVolume': undefined,
|
|
291
|
+
'info': ticker,
|
|
292
|
+
}, market);
|
|
293
|
+
}
|
|
294
|
+
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
295
|
+
const url = this.urls['api']['public'] + '/' + path;
|
|
296
|
+
headers = { 'Content-Type': 'application/json' };
|
|
297
|
+
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
298
|
+
}
|
|
299
|
+
}
|
|
@@ -1,2 +1,8 @@
|
|
|
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
|
+
|
|
1
7
|
export = $root;
|
|
2
8
|
declare var $root: {};
|
|
@@ -5,7 +5,7 @@ export function deflate(data: any, opts: any, cb: any): () => void;
|
|
|
5
5
|
* @param opts The compression options
|
|
6
6
|
* @returns The deflated version of the data
|
|
7
7
|
*/
|
|
8
|
-
export function deflateSync(data: any, opts: any): Uint8Array |
|
|
8
|
+
export function deflateSync(data: any, opts: any): Uint8Array | Uint16Array | Uint32Array;
|
|
9
9
|
export function inflate(data: any, opts: any, cb: any): () => void;
|
|
10
10
|
/**
|
|
11
11
|
* Expands DEFLATE data with no wrapper
|
|
@@ -21,7 +21,7 @@ export function gzip(data: any, opts: any, cb: any): () => void;
|
|
|
21
21
|
* @param opts The compression options
|
|
22
22
|
* @returns The gzipped version of the data
|
|
23
23
|
*/
|
|
24
|
-
export function gzipSync(data: any, opts: any): Uint8Array |
|
|
24
|
+
export function gzipSync(data: any, opts: any): Uint8Array | Uint16Array | Uint32Array;
|
|
25
25
|
export function gunzip(data: any, opts: any, cb: any): () => void;
|
|
26
26
|
/**
|
|
27
27
|
* Expands GZIP data
|
|
@@ -37,7 +37,7 @@ export function zlib(data: any, opts: any, cb: any): () => void;
|
|
|
37
37
|
* @param opts The compression options
|
|
38
38
|
* @returns The zlib-compressed version of the data
|
|
39
39
|
*/
|
|
40
|
-
export function zlibSync(data: any, opts: any): Uint8Array |
|
|
40
|
+
export function zlibSync(data: any, opts: any): Uint8Array | Uint16Array | Uint32Array;
|
|
41
41
|
export function unzlib(data: any, opts: any, cb: any): () => void;
|
|
42
42
|
/**
|
|
43
43
|
* Expands Zlib data
|
|
@@ -61,7 +61,7 @@ export function decompressSync(data: any, out: any): any;
|
|
|
61
61
|
* not need to be true unless decoding a binary string.
|
|
62
62
|
* @returns The string encoded in UTF-8/Latin-1 binary
|
|
63
63
|
*/
|
|
64
|
-
export function strToU8(str: any, latin1: any): Uint8Array |
|
|
64
|
+
export function strToU8(str: any, latin1: any): Uint8Array | Uint16Array | Uint32Array;
|
|
65
65
|
/**
|
|
66
66
|
* Converts a Uint8Array to a string
|
|
67
67
|
* @param dat The data to decode to string
|
|
@@ -69,7 +69,7 @@ export function strToU8(str: any, latin1: any): Uint8Array | Uint32Array | Uint1
|
|
|
69
69
|
* not need to be true unless encoding to binary string.
|
|
70
70
|
* @returns The original UTF-8/Latin-1 string
|
|
71
71
|
*/
|
|
72
|
-
export function strFromU8(dat: any, latin1: any): string | Uint8Array |
|
|
72
|
+
export function strFromU8(dat: any, latin1: any): string | Uint8Array | Uint16Array | Uint32Array;
|
|
73
73
|
export function zip(data: any, opts: any, cb: any): () => void;
|
|
74
74
|
/**
|
|
75
75
|
* Synchronously creates a ZIP file. Prefer using `zip` for better performance
|
|
@@ -12,7 +12,7 @@ export declare class Stream {
|
|
|
12
12
|
parseStringUTF(start: number, end: number): string;
|
|
13
13
|
parseStringBMP(start: number, end: number): string;
|
|
14
14
|
parseTime(start: number, end: number, shortYear: boolean): string;
|
|
15
|
-
parseInteger(start: number, end: number): string |
|
|
15
|
+
parseInteger(start: number, end: number): string | 0 | -1;
|
|
16
16
|
parseBitString(start: number, end: number, maxLength: number): string;
|
|
17
17
|
parseOctetString(start: number, end: number, maxLength: number): string;
|
|
18
18
|
parseOID(start: number, end: number, maxLength: number): string;
|
|
@@ -25,7 +25,7 @@ export declare class ASN1 {
|
|
|
25
25
|
private tag;
|
|
26
26
|
sub: ASN1[];
|
|
27
27
|
typeName(): string;
|
|
28
|
-
content(maxLength: number): string |
|
|
28
|
+
content(maxLength: number): string | 0 | -1;
|
|
29
29
|
toString(): string;
|
|
30
30
|
toPrettyString(indent: string): string;
|
|
31
31
|
posStart(): number;
|
|
@@ -15,7 +15,7 @@ export declare class BigInteger {
|
|
|
15
15
|
protected intValue(): number;
|
|
16
16
|
protected byteValue(): number;
|
|
17
17
|
protected shortValue(): number;
|
|
18
|
-
protected signum():
|
|
18
|
+
protected signum(): 0 | 1 | -1;
|
|
19
19
|
toByteArray(): number[];
|
|
20
20
|
protected equals(a: BigInteger): boolean;
|
|
21
21
|
protected min(a: BigInteger): BigInteger;
|
|
@@ -1,3 +1,9 @@
|
|
|
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
|
+
|
|
1
7
|
declare const _default: string;
|
|
2
8
|
export declare namespace formatters {
|
|
3
9
|
function RFC1738(value: any): string;
|
|
@@ -1,3 +1,9 @@
|
|
|
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
|
+
|
|
1
7
|
import formats = require("./formats.cjs");
|
|
2
8
|
import parse = require("./parse.cjs");
|
|
3
9
|
import stringify = require("./stringify.cjs");
|