ccxt-ir 4.12.1 → 4.12.3
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 +3 -3
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/src/hamtapay.js +46 -54
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/hamtapay.d.ts +1 -1
- package/js/src/hamtapay.js +46 -54
- package/js/test.js +28 -14
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -239,7 +239,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
239
239
|
|
|
240
240
|
//-----------------------------------------------------------------------------
|
|
241
241
|
// this is updated by vss.js when building
|
|
242
|
-
const version = '4.12.
|
|
242
|
+
const version = '4.12.3';
|
|
243
243
|
Exchange["default"].ccxtVersion = version;
|
|
244
244
|
const exchanges = {
|
|
245
245
|
'abantether': abantether["default"],
|
package/dist/cjs/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
{ "type": "commonjs" }
|
package/dist/cjs/src/hamtapay.js
CHANGED
|
@@ -79,6 +79,7 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
79
79
|
'fetchTradingFee': false,
|
|
80
80
|
'fetchTradingFees': false,
|
|
81
81
|
'fetchWithdrawals': false,
|
|
82
|
+
'otc': true,
|
|
82
83
|
'setLeverage': false,
|
|
83
84
|
'setMarginMode': false,
|
|
84
85
|
'transfer': false,
|
|
@@ -88,7 +89,7 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
88
89
|
'urls': {
|
|
89
90
|
'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/hamtapay/64x64.png',
|
|
90
91
|
'api': {
|
|
91
|
-
'public': 'https://
|
|
92
|
+
'public': 'https://oapi.hamtapay.org',
|
|
92
93
|
},
|
|
93
94
|
'www': 'https://hamtapay.net/',
|
|
94
95
|
'doc': [
|
|
@@ -99,7 +100,7 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
99
100
|
'public': {
|
|
100
101
|
'get': {
|
|
101
102
|
'/financial/api/market': 1,
|
|
102
|
-
'/financial/api/
|
|
103
|
+
'/financial/api/market/{symbol}': 1,
|
|
103
104
|
},
|
|
104
105
|
},
|
|
105
106
|
},
|
|
@@ -118,7 +119,7 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
118
119
|
* @method
|
|
119
120
|
* @name hamtapay#fetchMarkets
|
|
120
121
|
* @description retrieves data on all markets for hamtapay
|
|
121
|
-
* @see https://
|
|
122
|
+
* @see https://oapi.hamtapay.org/financial/api/market
|
|
122
123
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
123
124
|
* @returns {object[]} an array of objects representing market data
|
|
124
125
|
*/
|
|
@@ -171,8 +172,8 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
171
172
|
'strike': undefined,
|
|
172
173
|
'optionType': undefined,
|
|
173
174
|
'precision': {
|
|
174
|
-
'amount':
|
|
175
|
-
'price':
|
|
175
|
+
'amount': this.safeInteger(market, 'amount_decimals'),
|
|
176
|
+
'price': this.safeInteger(market, 'price_decimals'),
|
|
176
177
|
},
|
|
177
178
|
'limits': {
|
|
178
179
|
'leverage': {
|
|
@@ -201,7 +202,7 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
201
202
|
* @method
|
|
202
203
|
* @name hamtapay#fetchTickers
|
|
203
204
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
204
|
-
* @see https://
|
|
205
|
+
* @see https://oapi.hamtapay.org/financial/api/market
|
|
205
206
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
206
207
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
207
208
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -210,23 +211,12 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
210
211
|
if (symbols !== undefined) {
|
|
211
212
|
symbols = this.marketSymbols(symbols);
|
|
212
213
|
}
|
|
213
|
-
const response = await this.
|
|
214
|
-
const data = this.
|
|
214
|
+
const response = await this.publicGetFinancialApiMarket(params);
|
|
215
|
+
const data = this.safeList(response, 'data', []);
|
|
215
216
|
const result = {};
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
const corresponding_data = this.safeDict(data, current_qoute, {});
|
|
220
|
-
const baseSymbols = Object.keys(corresponding_data);
|
|
221
|
-
for (let j = 0; j < baseSymbols.length; j++) {
|
|
222
|
-
const current_base = baseSymbols[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
|
-
}
|
|
217
|
+
for (let i = 0; i < data.length; i++) {
|
|
218
|
+
const ticker = this.parseTicker(data[i]);
|
|
219
|
+
result[ticker['symbol']] = ticker;
|
|
230
220
|
}
|
|
231
221
|
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
232
222
|
}
|
|
@@ -235,48 +225,42 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
235
225
|
* @method
|
|
236
226
|
* @name hamtapay#fetchTicker
|
|
237
227
|
* @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.
|
|
228
|
+
* @see https://oapi.hamtapay.org/financial/api/market/{symbol}
|
|
239
229
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
240
230
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
241
231
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
242
232
|
*/
|
|
243
|
-
|
|
244
|
-
|
|
233
|
+
await this.loadMarkets();
|
|
234
|
+
const market = this.market(symbol);
|
|
235
|
+
const request = {
|
|
236
|
+
'symbol': market['id'],
|
|
237
|
+
};
|
|
238
|
+
const response = await this.publicGetFinancialApiMarketSymbol(this.extend(request, params));
|
|
239
|
+
const ticker = this.safeDict(response, 'data', response);
|
|
240
|
+
return this.parseTicker(ticker, market);
|
|
245
241
|
}
|
|
246
242
|
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
243
|
const marketType = 'otc';
|
|
263
|
-
const marketId = this.
|
|
264
|
-
const
|
|
265
|
-
const
|
|
266
|
-
const
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
244
|
+
const marketId = this.safeString2(ticker, 'id', 'symbol');
|
|
245
|
+
const baseId = this.safeString(ticker, 'base');
|
|
246
|
+
const quoteId = this.safeString(ticker, 'quote');
|
|
247
|
+
const base = this.safeCurrencyCode(baseId);
|
|
248
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
249
|
+
let symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
250
|
+
if ((baseId !== undefined) && (quoteId !== undefined)) {
|
|
251
|
+
symbol = base + '/' + quote;
|
|
252
|
+
}
|
|
253
|
+
const last = this.safeFloat(ticker, 'last_price');
|
|
254
|
+
const percentage = this.safeFloat(ticker, 'percent_change_24h');
|
|
271
255
|
return this.safeTicker({
|
|
272
256
|
'symbol': symbol,
|
|
273
257
|
'timestamp': undefined,
|
|
274
258
|
'datetime': undefined,
|
|
275
|
-
'high':
|
|
276
|
-
'low':
|
|
277
|
-
'bid':
|
|
259
|
+
'high': undefined,
|
|
260
|
+
'low': undefined,
|
|
261
|
+
'bid': undefined,
|
|
278
262
|
'bidVolume': undefined,
|
|
279
|
-
'ask':
|
|
263
|
+
'ask': undefined,
|
|
280
264
|
'askVolume': undefined,
|
|
281
265
|
'vwap': undefined,
|
|
282
266
|
'open': undefined,
|
|
@@ -284,7 +268,7 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
284
268
|
'last': last,
|
|
285
269
|
'previousClose': undefined,
|
|
286
270
|
'change': undefined,
|
|
287
|
-
'percentage':
|
|
271
|
+
'percentage': percentage,
|
|
288
272
|
'average': undefined,
|
|
289
273
|
'baseVolume': undefined,
|
|
290
274
|
'quoteVolume': undefined,
|
|
@@ -292,7 +276,15 @@ class hamtapay extends hamtapay$1["default"] {
|
|
|
292
276
|
}, market);
|
|
293
277
|
}
|
|
294
278
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
295
|
-
const
|
|
279
|
+
const query = this.omit(params, this.extractParams(path));
|
|
280
|
+
let normalizedPath = path;
|
|
281
|
+
while (normalizedPath.length && normalizedPath[0] === '/') {
|
|
282
|
+
normalizedPath = normalizedPath.slice(1);
|
|
283
|
+
}
|
|
284
|
+
let url = this.urls['api']['public'] + '/' + this.implodeParams(normalizedPath, params);
|
|
285
|
+
if (Object.keys(query).length) {
|
|
286
|
+
url += '?' + this.urlencode(query);
|
|
287
|
+
}
|
|
296
288
|
headers = {
|
|
297
289
|
'Content-Type': 'application/json',
|
|
298
290
|
'Origin': 'https://hamtapay.net',
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketMarginModes, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, LongShortRatio, OrderBooks, OpenInterests, ConstructorArgs } from './src/base/types.js';
|
|
6
6
|
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';
|
|
7
|
-
declare const version = "4.12.
|
|
7
|
+
declare const version = "4.12.3";
|
|
8
8
|
import abantether from './src/abantether.js';
|
|
9
9
|
import afratether from './src/afratether.js';
|
|
10
10
|
import alpaca from './src/alpaca.js';
|
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.12.
|
|
41
|
+
const version = '4.12.3';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import abantether from './src/abantether.js';
|
|
@@ -2,7 +2,7 @@ import { implicitReturnType } from '../base/types.js';
|
|
|
2
2
|
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
3
3
|
interface Exchange {
|
|
4
4
|
publicGetFinancialApiMarket(params?: {}): Promise<implicitReturnType>;
|
|
5
|
-
|
|
5
|
+
publicGetFinancialApiMarketSymbol(params?: {}): Promise<implicitReturnType>;
|
|
6
6
|
}
|
|
7
7
|
declare abstract class Exchange extends _Exchange {
|
|
8
8
|
}
|
package/js/src/hamtapay.js
CHANGED
|
@@ -80,6 +80,7 @@ export default class hamtapay 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,
|
|
@@ -89,7 +90,7 @@ export default class hamtapay extends Exchange {
|
|
|
89
90
|
'urls': {
|
|
90
91
|
'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/hamtapay/64x64.png',
|
|
91
92
|
'api': {
|
|
92
|
-
'public': 'https://
|
|
93
|
+
'public': 'https://oapi.hamtapay.org',
|
|
93
94
|
},
|
|
94
95
|
'www': 'https://hamtapay.net/',
|
|
95
96
|
'doc': [
|
|
@@ -100,7 +101,7 @@ export default class hamtapay extends Exchange {
|
|
|
100
101
|
'public': {
|
|
101
102
|
'get': {
|
|
102
103
|
'/financial/api/market': 1,
|
|
103
|
-
'/financial/api/
|
|
104
|
+
'/financial/api/market/{symbol}': 1,
|
|
104
105
|
},
|
|
105
106
|
},
|
|
106
107
|
},
|
|
@@ -119,7 +120,7 @@ export default class hamtapay extends Exchange {
|
|
|
119
120
|
* @method
|
|
120
121
|
* @name hamtapay#fetchMarkets
|
|
121
122
|
* @description retrieves data on all markets for hamtapay
|
|
122
|
-
* @see https://
|
|
123
|
+
* @see https://oapi.hamtapay.org/financial/api/market
|
|
123
124
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
124
125
|
* @returns {object[]} an array of objects representing market data
|
|
125
126
|
*/
|
|
@@ -172,8 +173,8 @@ export default class hamtapay extends Exchange {
|
|
|
172
173
|
'strike': undefined,
|
|
173
174
|
'optionType': undefined,
|
|
174
175
|
'precision': {
|
|
175
|
-
'amount':
|
|
176
|
-
'price':
|
|
176
|
+
'amount': this.safeInteger(market, 'amount_decimals'),
|
|
177
|
+
'price': this.safeInteger(market, 'price_decimals'),
|
|
177
178
|
},
|
|
178
179
|
'limits': {
|
|
179
180
|
'leverage': {
|
|
@@ -202,7 +203,7 @@ export default class hamtapay extends Exchange {
|
|
|
202
203
|
* @method
|
|
203
204
|
* @name hamtapay#fetchTickers
|
|
204
205
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
205
|
-
* @see https://
|
|
206
|
+
* @see https://oapi.hamtapay.org/financial/api/market
|
|
206
207
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
207
208
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
208
209
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -211,23 +212,12 @@ export default class hamtapay extends Exchange {
|
|
|
211
212
|
if (symbols !== undefined) {
|
|
212
213
|
symbols = this.marketSymbols(symbols);
|
|
213
214
|
}
|
|
214
|
-
const response = await this.
|
|
215
|
-
const data = this.
|
|
215
|
+
const response = await this.publicGetFinancialApiMarket(params);
|
|
216
|
+
const data = this.safeList(response, 'data', []);
|
|
216
217
|
const result = {};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const corresponding_data = this.safeDict(data, current_qoute, {});
|
|
221
|
-
const baseSymbols = Object.keys(corresponding_data);
|
|
222
|
-
for (let j = 0; j < baseSymbols.length; j++) {
|
|
223
|
-
const current_base = baseSymbols[j];
|
|
224
|
-
const current_ticker = corresponding_data[current_base];
|
|
225
|
-
current_ticker['base'] = current_base;
|
|
226
|
-
current_ticker['quote'] = current_qoute;
|
|
227
|
-
current_ticker['symbol'] = current_base + '/' + current_qoute;
|
|
228
|
-
current_ticker['id'] = current_base + '-' + current_qoute;
|
|
229
|
-
result[current_ticker['symbol']] = this.parseTicker(current_ticker);
|
|
230
|
-
}
|
|
218
|
+
for (let i = 0; i < data.length; i++) {
|
|
219
|
+
const ticker = this.parseTicker(data[i]);
|
|
220
|
+
result[ticker['symbol']] = ticker;
|
|
231
221
|
}
|
|
232
222
|
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
233
223
|
}
|
|
@@ -236,48 +226,42 @@ export default class hamtapay extends Exchange {
|
|
|
236
226
|
* @method
|
|
237
227
|
* @name hamtapay#fetchTicker
|
|
238
228
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
239
|
-
* @see https://hamtapay.
|
|
229
|
+
* @see https://oapi.hamtapay.org/financial/api/market/{symbol}
|
|
240
230
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
241
231
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
242
232
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
243
233
|
*/
|
|
244
|
-
|
|
245
|
-
|
|
234
|
+
await this.loadMarkets();
|
|
235
|
+
const market = this.market(symbol);
|
|
236
|
+
const request = {
|
|
237
|
+
'symbol': market['id'],
|
|
238
|
+
};
|
|
239
|
+
const response = await this.publicGetFinancialApiMarketSymbol(this.extend(request, params));
|
|
240
|
+
const ticker = this.safeDict(response, 'data', response);
|
|
241
|
+
return this.parseTicker(ticker, market);
|
|
246
242
|
}
|
|
247
243
|
parseTicker(ticker, market = undefined) {
|
|
248
|
-
// {
|
|
249
|
-
// "id": "USDT-IRT",
|
|
250
|
-
// "symbol": "USDT/IRT",
|
|
251
|
-
// "base": "USDT",
|
|
252
|
-
// "quote": "IRT",
|
|
253
|
-
// "min_price_24h": "111702",
|
|
254
|
-
// "max_price_24h": "115872",
|
|
255
|
-
// "market_price": "115942",
|
|
256
|
-
// "buy_price": "117101",
|
|
257
|
-
// "sell_price": "114782",
|
|
258
|
-
// "change_rate_24h": 3.29,
|
|
259
|
-
// "amount_decimals": 0,
|
|
260
|
-
// "price_decimals": 0,
|
|
261
|
-
// "status": "ACTIVE"
|
|
262
|
-
// }
|
|
263
244
|
const marketType = 'otc';
|
|
264
|
-
const marketId = this.
|
|
265
|
-
const
|
|
266
|
-
const
|
|
267
|
-
const
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
245
|
+
const marketId = this.safeString2(ticker, 'id', 'symbol');
|
|
246
|
+
const baseId = this.safeString(ticker, 'base');
|
|
247
|
+
const quoteId = this.safeString(ticker, 'quote');
|
|
248
|
+
const base = this.safeCurrencyCode(baseId);
|
|
249
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
250
|
+
let symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
251
|
+
if ((baseId !== undefined) && (quoteId !== undefined)) {
|
|
252
|
+
symbol = base + '/' + quote;
|
|
253
|
+
}
|
|
254
|
+
const last = this.safeFloat(ticker, 'last_price');
|
|
255
|
+
const percentage = this.safeFloat(ticker, 'percent_change_24h');
|
|
272
256
|
return this.safeTicker({
|
|
273
257
|
'symbol': symbol,
|
|
274
258
|
'timestamp': undefined,
|
|
275
259
|
'datetime': undefined,
|
|
276
|
-
'high':
|
|
277
|
-
'low':
|
|
278
|
-
'bid':
|
|
260
|
+
'high': undefined,
|
|
261
|
+
'low': undefined,
|
|
262
|
+
'bid': undefined,
|
|
279
263
|
'bidVolume': undefined,
|
|
280
|
-
'ask':
|
|
264
|
+
'ask': undefined,
|
|
281
265
|
'askVolume': undefined,
|
|
282
266
|
'vwap': undefined,
|
|
283
267
|
'open': undefined,
|
|
@@ -285,7 +269,7 @@ export default class hamtapay extends Exchange {
|
|
|
285
269
|
'last': last,
|
|
286
270
|
'previousClose': undefined,
|
|
287
271
|
'change': undefined,
|
|
288
|
-
'percentage':
|
|
272
|
+
'percentage': percentage,
|
|
289
273
|
'average': undefined,
|
|
290
274
|
'baseVolume': undefined,
|
|
291
275
|
'quoteVolume': undefined,
|
|
@@ -293,7 +277,15 @@ export default class hamtapay extends Exchange {
|
|
|
293
277
|
}, market);
|
|
294
278
|
}
|
|
295
279
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
296
|
-
const
|
|
280
|
+
const query = this.omit(params, this.extractParams(path));
|
|
281
|
+
let normalizedPath = path;
|
|
282
|
+
while (normalizedPath.length && normalizedPath[0] === '/') {
|
|
283
|
+
normalizedPath = normalizedPath.slice(1);
|
|
284
|
+
}
|
|
285
|
+
let url = this.urls['api']['public'] + '/' + this.implodeParams(normalizedPath, params);
|
|
286
|
+
if (Object.keys(query).length) {
|
|
287
|
+
url += '?' + this.urlencode(query);
|
|
288
|
+
}
|
|
297
289
|
headers = {
|
|
298
290
|
'Content-Type': 'application/json',
|
|
299
291
|
'Origin': 'https://hamtapay.net',
|
package/js/test.js
CHANGED
|
@@ -4,24 +4,38 @@
|
|
|
4
4
|
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
|
5
5
|
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
async function
|
|
9
|
-
const exchange = new
|
|
7
|
+
import ccxt from './ccxt';
|
|
8
|
+
async function testHamtapay() {
|
|
9
|
+
const exchange = new ccxt.hamtapay({
|
|
10
10
|
enableRateLimit: true,
|
|
11
|
+
timeout: 20000,
|
|
11
12
|
});
|
|
12
13
|
try {
|
|
13
|
-
const markets = await exchange.fetchMarkets(
|
|
14
|
-
|
|
15
|
-
console.log('
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const markets = await exchange.fetchMarkets();
|
|
15
|
+
console.log('markets count:', markets.length);
|
|
16
|
+
console.log('first markets:', markets.slice(0, 10).map((market) => ({
|
|
17
|
+
symbol: market.symbol,
|
|
18
|
+
id: market.id,
|
|
19
|
+
type: market.type,
|
|
20
|
+
active: market.active,
|
|
21
|
+
amountPrecision: market.precision && market.precision.amount,
|
|
22
|
+
pricePrecision: market.precision && market.precision.price,
|
|
23
|
+
})));
|
|
24
|
+
const tickers = await exchange.fetchTickers();
|
|
25
|
+
console.log('tickers count:', Object.keys(tickers).length);
|
|
26
|
+
const symbol = 'USDT/IRT';
|
|
27
|
+
const ticker = await exchange.fetchTicker(symbol);
|
|
28
|
+
console.log('single ticker:', {
|
|
29
|
+
symbol: ticker.symbol,
|
|
30
|
+
last: ticker.last,
|
|
31
|
+
percentage: ticker.percentage,
|
|
32
|
+
baseVolume: ticker.baseVolume,
|
|
33
|
+
quoteVolume: ticker.quoteVolume,
|
|
34
|
+
info: ticker.info,
|
|
35
|
+
});
|
|
18
36
|
}
|
|
19
37
|
catch (error) {
|
|
20
|
-
console.error('
|
|
21
|
-
process.exitCode = 1;
|
|
22
|
-
}
|
|
23
|
-
finally {
|
|
24
|
-
await exchange.close();
|
|
38
|
+
console.error('Error during testing hamtapay:', error);
|
|
25
39
|
}
|
|
26
40
|
}
|
|
27
|
-
|
|
41
|
+
testHamtapay();
|
package/package.json
CHANGED