ccxt-ir 4.12.3 → 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.3';
242
+ const version = '4.12.4';
243
243
  Exchange["default"].ccxtVersion = version;
244
244
  const exchanges = {
245
245
  'abantether': abantether["default"],
@@ -79,7 +79,6 @@ class hamtapay extends hamtapay$1["default"] {
79
79
  'fetchTradingFee': false,
80
80
  'fetchTradingFees': false,
81
81
  'fetchWithdrawals': false,
82
- 'otc': true,
83
82
  'setLeverage': false,
84
83
  'setMarginMode': false,
85
84
  'transfer': false,
@@ -100,7 +99,6 @@ class hamtapay extends hamtapay$1["default"] {
100
99
  'public': {
101
100
  'get': {
102
101
  '/financial/api/market': 1,
103
- '/financial/api/market/{symbol}': 1,
104
102
  },
105
103
  },
106
104
  },
@@ -156,8 +154,8 @@ class hamtapay extends hamtapay$1["default"] {
156
154
  'baseId': baseId,
157
155
  'quoteId': quoteId,
158
156
  'settleId': undefined,
159
- 'type': 'otc',
160
- 'spot': false,
157
+ 'type': 'spot',
158
+ 'spot': true,
161
159
  'margin': false,
162
160
  'swap': false,
163
161
  'future': false,
@@ -225,22 +223,16 @@ class hamtapay extends hamtapay$1["default"] {
225
223
  * @method
226
224
  * @name hamtapay#fetchTicker
227
225
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
228
- * @see https://oapi.hamtapay.org/financial/api/market/{symbol}
226
+ * @see https://oapi.hamtapay.org/financial/api/market
229
227
  * @param {string} symbol unified symbol of the market to fetch the ticker for
230
228
  * @param {object} [params] extra parameters specific to the exchange API endpoint
231
229
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
232
230
  */
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);
231
+ const tickers = await this.fetchTickers([symbol], params);
232
+ return tickers[symbol];
241
233
  }
242
234
  parseTicker(ticker, market = undefined) {
243
- const marketType = 'otc';
235
+ const marketType = 'spot';
244
236
  const marketId = this.safeString2(ticker, 'id', 'symbol');
245
237
  const baseId = this.safeString(ticker, 'base');
246
238
  const quoteId = this.safeString(ticker, 'quote');
@@ -251,7 +243,12 @@ class hamtapay extends hamtapay$1["default"] {
251
243
  symbol = base + '/' + quote;
252
244
  }
253
245
  const last = this.safeFloat(ticker, 'last_price');
246
+ const baseVolume = this.safeFloat(ticker, 'volume_24h');
254
247
  const percentage = this.safeFloat(ticker, 'percent_change_24h');
248
+ let quoteVolume = undefined;
249
+ if ((baseVolume !== undefined) && (last !== undefined)) {
250
+ quoteVolume = baseVolume * last;
251
+ }
255
252
  return this.safeTicker({
256
253
  'symbol': symbol,
257
254
  'timestamp': undefined,
@@ -270,8 +267,8 @@ class hamtapay extends hamtapay$1["default"] {
270
267
  'change': undefined,
271
268
  'percentage': percentage,
272
269
  'average': undefined,
273
- 'baseVolume': undefined,
274
- 'quoteVolume': undefined,
270
+ 'baseVolume': baseVolume,
271
+ 'quoteVolume': quoteVolume,
275
272
  'info': ticker,
276
273
  }, market);
277
274
  }
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.3";
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.3';
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
- publicGetFinancialApiMarketSymbol(params?: {}): Promise<implicitReturnType>;
6
5
  }
7
6
  declare abstract class Exchange extends _Exchange {
8
7
  }
@@ -80,7 +80,6 @@ export default class hamtapay extends Exchange {
80
80
  'fetchTradingFee': false,
81
81
  'fetchTradingFees': false,
82
82
  'fetchWithdrawals': false,
83
- 'otc': true,
84
83
  'setLeverage': false,
85
84
  'setMarginMode': false,
86
85
  'transfer': false,
@@ -101,7 +100,6 @@ export default class hamtapay extends Exchange {
101
100
  'public': {
102
101
  'get': {
103
102
  '/financial/api/market': 1,
104
- '/financial/api/market/{symbol}': 1,
105
103
  },
106
104
  },
107
105
  },
@@ -157,8 +155,8 @@ export default class hamtapay extends Exchange {
157
155
  'baseId': baseId,
158
156
  'quoteId': quoteId,
159
157
  'settleId': undefined,
160
- 'type': 'otc',
161
- 'spot': false,
158
+ 'type': 'spot',
159
+ 'spot': true,
162
160
  'margin': false,
163
161
  'swap': false,
164
162
  'future': false,
@@ -226,22 +224,16 @@ export default class hamtapay extends Exchange {
226
224
  * @method
227
225
  * @name hamtapay#fetchTicker
228
226
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
229
- * @see https://oapi.hamtapay.org/financial/api/market/{symbol}
227
+ * @see https://oapi.hamtapay.org/financial/api/market
230
228
  * @param {string} symbol unified symbol of the market to fetch the ticker for
231
229
  * @param {object} [params] extra parameters specific to the exchange API endpoint
232
230
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
233
231
  */
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);
232
+ const tickers = await this.fetchTickers([symbol], params);
233
+ return tickers[symbol];
242
234
  }
243
235
  parseTicker(ticker, market = undefined) {
244
- const marketType = 'otc';
236
+ const marketType = 'spot';
245
237
  const marketId = this.safeString2(ticker, 'id', 'symbol');
246
238
  const baseId = this.safeString(ticker, 'base');
247
239
  const quoteId = this.safeString(ticker, 'quote');
@@ -252,7 +244,12 @@ export default class hamtapay extends Exchange {
252
244
  symbol = base + '/' + quote;
253
245
  }
254
246
  const last = this.safeFloat(ticker, 'last_price');
247
+ const baseVolume = this.safeFloat(ticker, 'volume_24h');
255
248
  const percentage = this.safeFloat(ticker, 'percent_change_24h');
249
+ let quoteVolume = undefined;
250
+ if ((baseVolume !== undefined) && (last !== undefined)) {
251
+ quoteVolume = baseVolume * last;
252
+ }
256
253
  return this.safeTicker({
257
254
  'symbol': symbol,
258
255
  'timestamp': undefined,
@@ -271,8 +268,8 @@ export default class hamtapay extends Exchange {
271
268
  'change': undefined,
272
269
  'percentage': percentage,
273
270
  'average': undefined,
274
- 'baseVolume': undefined,
275
- 'quoteVolume': undefined,
271
+ 'baseVolume': baseVolume,
272
+ 'quoteVolume': quoteVolume,
276
273
  'info': ticker,
277
274
  }, market);
278
275
  }
package/js/test.js CHANGED
@@ -23,7 +23,7 @@ async function testHamtapay() {
23
23
  })));
24
24
  const tickers = await exchange.fetchTickers();
25
25
  console.log('tickers count:', Object.keys(tickers).length);
26
- const symbol = 'USDT/IRT';
26
+ const symbol = 'BTC/USDT';
27
27
  const ticker = await exchange.fetchTicker(symbol);
28
28
  console.log('single ticker:', {
29
29
  symbol: ticker.symbol,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt-ir",
3
- "version": "4.12.3",
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",