ccxt-ir 4.12.2 → 4.12.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/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.2';
242
+ const version = '4.12.4';
243
243
  Exchange["default"].ccxtVersion = version;
244
244
  const exchanges = {
245
245
  'abantether': abantether["default"],
@@ -88,7 +88,7 @@ class hamtapay extends hamtapay$1["default"] {
88
88
  'urls': {
89
89
  'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/hamtapay/64x64.png',
90
90
  'api': {
91
- 'public': 'https://api.hamtapay.org',
91
+ 'public': 'https://oapi.hamtapay.org',
92
92
  },
93
93
  'www': 'https://hamtapay.net/',
94
94
  'doc': [
@@ -99,7 +99,6 @@ class hamtapay extends hamtapay$1["default"] {
99
99
  'public': {
100
100
  'get': {
101
101
  '/financial/api/market': 1,
102
- '/financial/api/vitrin/prices': 1,
103
102
  },
104
103
  },
105
104
  },
@@ -118,7 +117,7 @@ class hamtapay extends hamtapay$1["default"] {
118
117
  * @method
119
118
  * @name hamtapay#fetchMarkets
120
119
  * @description retrieves data on all markets for hamtapay
121
- * @see https://api.hamtapay.org/financial/api/market
120
+ * @see https://oapi.hamtapay.org/financial/api/market
122
121
  * @param {object} [params] extra parameters specific to the exchange API endpoint
123
122
  * @returns {object[]} an array of objects representing market data
124
123
  */
@@ -155,8 +154,8 @@ class hamtapay extends hamtapay$1["default"] {
155
154
  'baseId': baseId,
156
155
  'quoteId': quoteId,
157
156
  'settleId': undefined,
158
- 'type': 'otc',
159
- 'spot': false,
157
+ 'type': 'spot',
158
+ 'spot': true,
160
159
  'margin': false,
161
160
  'swap': false,
162
161
  'future': false,
@@ -171,8 +170,8 @@ class hamtapay extends hamtapay$1["default"] {
171
170
  'strike': undefined,
172
171
  'optionType': undefined,
173
172
  'precision': {
174
- 'amount': undefined,
175
- 'price': undefined,
173
+ 'amount': this.safeInteger(market, 'amount_decimals'),
174
+ 'price': this.safeInteger(market, 'price_decimals'),
176
175
  },
177
176
  'limits': {
178
177
  'leverage': {
@@ -201,7 +200,7 @@ class hamtapay extends hamtapay$1["default"] {
201
200
  * @method
202
201
  * @name hamtapay#fetchTickers
203
202
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
204
- * @see https://api.hamtapay.org/financial/api/vitrin/prices
203
+ * @see https://oapi.hamtapay.org/financial/api/market
205
204
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
206
205
  * @param {object} [params] extra parameters specific to the exchange API endpoint
207
206
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -210,23 +209,12 @@ class hamtapay extends hamtapay$1["default"] {
210
209
  if (symbols !== undefined) {
211
210
  symbols = this.marketSymbols(symbols);
212
211
  }
213
- const response = await this.publicGetFinancialApiVitrinPrices(params);
214
- const data = this.safeDict(response, 'data', {});
212
+ const response = await this.publicGetFinancialApiMarket(params);
213
+ const data = this.safeList(response, 'data', []);
215
214
  const result = {};
216
- const quotes = ['IRT', 'USDT'];
217
- for (let i = 0; i < quotes.length; i++) {
218
- const current_qoute = quotes[i];
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
- }
215
+ for (let i = 0; i < data.length; i++) {
216
+ const ticker = this.parseTicker(data[i]);
217
+ result[ticker['symbol']] = ticker;
230
218
  }
231
219
  return this.filterByArrayTickers(result, 'symbol', symbols);
232
220
  }
@@ -235,48 +223,41 @@ class hamtapay extends hamtapay$1["default"] {
235
223
  * @method
236
224
  * @name hamtapay#fetchTicker
237
225
  * @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
226
+ * @see https://oapi.hamtapay.org/financial/api/market
239
227
  * @param {string} symbol unified symbol of the market to fetch the ticker for
240
228
  * @param {object} [params] extra parameters specific to the exchange API endpoint
241
229
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
242
230
  */
243
- const ticker = await this.fetchTickers([symbol]);
244
- return ticker[symbol];
231
+ const tickers = await this.fetchTickers([symbol], params);
232
+ return tickers[symbol];
245
233
  }
246
234
  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);
235
+ const marketType = 'spot';
236
+ const marketId = this.safeString2(ticker, 'id', 'symbol');
237
+ const baseId = this.safeString(ticker, 'base');
238
+ const quoteId = this.safeString(ticker, 'quote');
239
+ const base = this.safeCurrencyCode(baseId);
240
+ const quote = this.safeCurrencyCode(quoteId);
241
+ let symbol = this.safeSymbol(marketId, market, undefined, marketType);
242
+ if ((baseId !== undefined) && (quoteId !== undefined)) {
243
+ symbol = base + '/' + quote;
244
+ }
245
+ const last = this.safeFloat(ticker, 'last_price');
246
+ const baseVolume = this.safeFloat(ticker, 'volume_24h');
247
+ const percentage = this.safeFloat(ticker, 'percent_change_24h');
248
+ let quoteVolume = undefined;
249
+ if ((baseVolume !== undefined) && (last !== undefined)) {
250
+ quoteVolume = baseVolume * last;
251
+ }
271
252
  return this.safeTicker({
272
253
  'symbol': symbol,
273
254
  'timestamp': undefined,
274
255
  'datetime': undefined,
275
- 'high': high,
276
- 'low': low,
277
- 'bid': bid,
256
+ 'high': undefined,
257
+ 'low': undefined,
258
+ 'bid': undefined,
278
259
  'bidVolume': undefined,
279
- 'ask': ask,
260
+ 'ask': undefined,
280
261
  'askVolume': undefined,
281
262
  'vwap': undefined,
282
263
  'open': undefined,
@@ -284,15 +265,23 @@ class hamtapay extends hamtapay$1["default"] {
284
265
  'last': last,
285
266
  'previousClose': undefined,
286
267
  'change': undefined,
287
- 'percentage': change,
268
+ 'percentage': percentage,
288
269
  'average': undefined,
289
- 'baseVolume': undefined,
290
- 'quoteVolume': undefined,
270
+ 'baseVolume': baseVolume,
271
+ 'quoteVolume': quoteVolume,
291
272
  'info': ticker,
292
273
  }, market);
293
274
  }
294
275
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
295
- const url = this.urls['api']['public'] + '/' + path;
276
+ const query = this.omit(params, this.extractParams(path));
277
+ let normalizedPath = path;
278
+ while (normalizedPath.length && normalizedPath[0] === '/') {
279
+ normalizedPath = normalizedPath.slice(1);
280
+ }
281
+ let url = this.urls['api']['public'] + '/' + this.implodeParams(normalizedPath, params);
282
+ if (Object.keys(query).length) {
283
+ url += '?' + this.urlencode(query);
284
+ }
296
285
  headers = {
297
286
  'Content-Type': 'application/json',
298
287
  '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.2";
7
+ declare const version = "4.12.4";
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.2';
41
+ const version = '4.12.4';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import abantether from './src/abantether.js';
@@ -2,7 +2,6 @@ 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
- publicGetFinancialApiVitrinPrices(params?: {}): Promise<implicitReturnType>;
6
5
  }
7
6
  declare abstract class Exchange extends _Exchange {
8
7
  }
@@ -89,7 +89,7 @@ export default class hamtapay extends Exchange {
89
89
  'urls': {
90
90
  'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/hamtapay/64x64.png',
91
91
  'api': {
92
- 'public': 'https://api.hamtapay.org',
92
+ 'public': 'https://oapi.hamtapay.org',
93
93
  },
94
94
  'www': 'https://hamtapay.net/',
95
95
  'doc': [
@@ -100,7 +100,6 @@ export default class hamtapay extends Exchange {
100
100
  'public': {
101
101
  'get': {
102
102
  '/financial/api/market': 1,
103
- '/financial/api/vitrin/prices': 1,
104
103
  },
105
104
  },
106
105
  },
@@ -119,7 +118,7 @@ export default class hamtapay extends Exchange {
119
118
  * @method
120
119
  * @name hamtapay#fetchMarkets
121
120
  * @description retrieves data on all markets for hamtapay
122
- * @see https://api.hamtapay.org/financial/api/market
121
+ * @see https://oapi.hamtapay.org/financial/api/market
123
122
  * @param {object} [params] extra parameters specific to the exchange API endpoint
124
123
  * @returns {object[]} an array of objects representing market data
125
124
  */
@@ -156,8 +155,8 @@ export default class hamtapay extends Exchange {
156
155
  'baseId': baseId,
157
156
  'quoteId': quoteId,
158
157
  'settleId': undefined,
159
- 'type': 'otc',
160
- 'spot': false,
158
+ 'type': 'spot',
159
+ 'spot': true,
161
160
  'margin': false,
162
161
  'swap': false,
163
162
  'future': false,
@@ -172,8 +171,8 @@ export default class hamtapay extends Exchange {
172
171
  'strike': undefined,
173
172
  'optionType': undefined,
174
173
  'precision': {
175
- 'amount': undefined,
176
- 'price': undefined,
174
+ 'amount': this.safeInteger(market, 'amount_decimals'),
175
+ 'price': this.safeInteger(market, 'price_decimals'),
177
176
  },
178
177
  'limits': {
179
178
  'leverage': {
@@ -202,7 +201,7 @@ export default class hamtapay extends Exchange {
202
201
  * @method
203
202
  * @name hamtapay#fetchTickers
204
203
  * @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
204
+ * @see https://oapi.hamtapay.org/financial/api/market
206
205
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
207
206
  * @param {object} [params] extra parameters specific to the exchange API endpoint
208
207
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -211,23 +210,12 @@ export default class hamtapay extends Exchange {
211
210
  if (symbols !== undefined) {
212
211
  symbols = this.marketSymbols(symbols);
213
212
  }
214
- const response = await this.publicGetFinancialApiVitrinPrices(params);
215
- const data = this.safeDict(response, 'data', {});
213
+ const response = await this.publicGetFinancialApiMarket(params);
214
+ const data = this.safeList(response, 'data', []);
216
215
  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
- 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
- }
216
+ for (let i = 0; i < data.length; i++) {
217
+ const ticker = this.parseTicker(data[i]);
218
+ result[ticker['symbol']] = ticker;
231
219
  }
232
220
  return this.filterByArrayTickers(result, 'symbol', symbols);
233
221
  }
@@ -236,48 +224,41 @@ export default class hamtapay extends Exchange {
236
224
  * @method
237
225
  * @name hamtapay#fetchTicker
238
226
  * @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.com/management/all-coins/?format=json
227
+ * @see https://oapi.hamtapay.org/financial/api/market
240
228
  * @param {string} symbol unified symbol of the market to fetch the ticker for
241
229
  * @param {object} [params] extra parameters specific to the exchange API endpoint
242
230
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
243
231
  */
244
- const ticker = await this.fetchTickers([symbol]);
245
- return ticker[symbol];
232
+ const tickers = await this.fetchTickers([symbol], params);
233
+ return tickers[symbol];
246
234
  }
247
235
  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
- const marketType = 'otc';
264
- const marketId = this.safeString(ticker, 'id');
265
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
266
- const last = this.safeFloat(ticker, 'buy_price', 0);
267
- const change = this.safeFloat(ticker, 'change_rate_24h', 0);
268
- const ask = this.safeFloat(ticker, 'buy_price', 0);
269
- const bid = this.safeFloat(ticker, 'sell_price', 0);
270
- const high = this.safeFloat(ticker, 'max_price_24h', 0);
271
- const low = this.safeFloat(ticker, 'min_price_24h', 0);
236
+ const marketType = 'spot';
237
+ const marketId = this.safeString2(ticker, 'id', 'symbol');
238
+ const baseId = this.safeString(ticker, 'base');
239
+ const quoteId = this.safeString(ticker, 'quote');
240
+ const base = this.safeCurrencyCode(baseId);
241
+ const quote = this.safeCurrencyCode(quoteId);
242
+ let symbol = this.safeSymbol(marketId, market, undefined, marketType);
243
+ if ((baseId !== undefined) && (quoteId !== undefined)) {
244
+ symbol = base + '/' + quote;
245
+ }
246
+ const last = this.safeFloat(ticker, 'last_price');
247
+ const baseVolume = this.safeFloat(ticker, 'volume_24h');
248
+ const percentage = this.safeFloat(ticker, 'percent_change_24h');
249
+ let quoteVolume = undefined;
250
+ if ((baseVolume !== undefined) && (last !== undefined)) {
251
+ quoteVolume = baseVolume * last;
252
+ }
272
253
  return this.safeTicker({
273
254
  'symbol': symbol,
274
255
  'timestamp': undefined,
275
256
  'datetime': undefined,
276
- 'high': high,
277
- 'low': low,
278
- 'bid': bid,
257
+ 'high': undefined,
258
+ 'low': undefined,
259
+ 'bid': undefined,
279
260
  'bidVolume': undefined,
280
- 'ask': ask,
261
+ 'ask': undefined,
281
262
  'askVolume': undefined,
282
263
  'vwap': undefined,
283
264
  'open': undefined,
@@ -285,15 +266,23 @@ export default class hamtapay extends Exchange {
285
266
  'last': last,
286
267
  'previousClose': undefined,
287
268
  'change': undefined,
288
- 'percentage': change,
269
+ 'percentage': percentage,
289
270
  'average': undefined,
290
- 'baseVolume': undefined,
291
- 'quoteVolume': undefined,
271
+ 'baseVolume': baseVolume,
272
+ 'quoteVolume': quoteVolume,
292
273
  'info': ticker,
293
274
  }, market);
294
275
  }
295
276
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
296
- const url = this.urls['api']['public'] + '/' + path;
277
+ const query = this.omit(params, this.extractParams(path));
278
+ let normalizedPath = path;
279
+ while (normalizedPath.length && normalizedPath[0] === '/') {
280
+ normalizedPath = normalizedPath.slice(1);
281
+ }
282
+ let url = this.urls['api']['public'] + '/' + this.implodeParams(normalizedPath, params);
283
+ if (Object.keys(query).length) {
284
+ url += '?' + this.urlencode(query);
285
+ }
297
286
  headers = {
298
287
  'Content-Type': 'application/json',
299
288
  'Origin': 'https://hamtapay.net',
@@ -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(): 0 | 1 | -1;
18
+ protected signum(): 1 | 0 | -1;
19
19
  toByteArray(): number[];
20
20
  protected equals(a: BigInteger): boolean;
21
21
  protected min(a: BigInteger): BigInteger;
@@ -1,5 +1,5 @@
1
1
  import { Abi, FunctionAbi, RawArgs } from '../../../types/index.js';
2
2
  import { AbiParserInterface } from './interface.js';
3
3
  export declare function createAbiParser(abi: Abi): AbiParserInterface;
4
- export declare function getAbiVersion(abi: Abi): 0 | 1 | 2;
4
+ export declare function getAbiVersion(abi: Abi): 1 | 0 | 2;
5
5
  export declare function isNoConstructorValid(method: string, argsCalldata: RawArgs, abiMethod?: FunctionAbi): boolean;
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 { ourbit } from './ccxt.js';
8
- async function main() {
9
- const exchange = new ourbit({
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({ type: 'spot' });
14
- const firstSpotMarket = markets[0];
15
- console.log('Exchange:', exchange.id);
16
- console.log('Spot markets count:', markets.length);
17
- console.log('First spot market:', firstSpotMarket);
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 = 'BTC/USDT';
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('Test failed:', 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
- void main();
41
+ testHamtapay();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt-ir",
3
- "version": "4.12.2",
3
+ "version": "4.12.4",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",