ccxt 4.3.46 → 4.3.47

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
@@ -188,7 +188,7 @@ var woofipro$1 = require('./src/pro/woofipro.js');
188
188
 
189
189
  //-----------------------------------------------------------------------------
190
190
  // this is updated by vss.js when building
191
- const version = '4.3.46';
191
+ const version = '4.3.47';
192
192
  Exchange["default"].ccxtVersion = version;
193
193
  const exchanges = {
194
194
  'ace': ace,
@@ -82,8 +82,8 @@ const truncate_to_string = (num, precision = 0) => {
82
82
  const truncate = (num, precision = 0) => parseFloat(truncate_to_string(num, precision));
83
83
  function precisionFromString(str) {
84
84
  // support string formats like '1e-4'
85
- if (str.indexOf('e') > -1) {
86
- const numStr = str.replace(/\de/, '');
85
+ if (str.indexOf('e') > -1 || str.indexOf('E') > -1) {
86
+ const numStr = str.replace(/\d\.?\d*[eE]/, '');
87
87
  return parseInt(numStr) * -1;
88
88
  }
89
89
  // support integer formats (without dot) like '1', '10' etc [Note: bug in decimalToPrecision, so this should not be used atm]
@@ -4411,7 +4411,7 @@ class bitget extends bitget$1 {
4411
4411
  }
4412
4412
  if (marginMode !== undefined) {
4413
4413
  request['loanType'] = 'normal';
4414
- if (createMarketBuyOrderRequiresPrice && isMarketOrder && (side === 'buy')) {
4414
+ if (isMarketOrder && (side === 'buy')) {
4415
4415
  request['quoteSize'] = quantity;
4416
4416
  }
4417
4417
  else {
@@ -2330,7 +2330,7 @@ class bitmart extends bitmart$1 {
2330
2330
  const trailingActivationPrice = this.safeNumber(order, 'activation_price');
2331
2331
  return this.safeOrder({
2332
2332
  'id': id,
2333
- 'clientOrderId': this.safeString(order, 'client_order_id'),
2333
+ 'clientOrderId': this.safeString2(order, 'client_order_id', 'clientOrderId'),
2334
2334
  'info': order,
2335
2335
  'timestamp': timestamp,
2336
2336
  'datetime': this.iso8601(timestamp),
@@ -2476,6 +2476,33 @@ class hyperliquid extends hyperliquid$1 {
2476
2476
  const response = await this.privatePostExchange(this.extend(request, params));
2477
2477
  return this.parseTransaction(response);
2478
2478
  }
2479
+ parseTransaction(transaction, currency = undefined) {
2480
+ //
2481
+ // { status: 'ok', response: { type: 'default' } }
2482
+ //
2483
+ return {
2484
+ 'info': transaction,
2485
+ 'id': undefined,
2486
+ 'txid': undefined,
2487
+ 'timestamp': undefined,
2488
+ 'datetime': undefined,
2489
+ 'network': undefined,
2490
+ 'address': undefined,
2491
+ 'addressTo': undefined,
2492
+ 'addressFrom': undefined,
2493
+ 'tag': undefined,
2494
+ 'tagTo': undefined,
2495
+ 'tagFrom': undefined,
2496
+ 'type': undefined,
2497
+ 'amount': undefined,
2498
+ 'currency': undefined,
2499
+ 'status': this.safeString(transaction, 'status'),
2500
+ 'updated': undefined,
2501
+ 'comment': undefined,
2502
+ 'internal': undefined,
2503
+ 'fee': undefined,
2504
+ };
2505
+ }
2479
2506
  formatVaultAddress(address = undefined) {
2480
2507
  if (address === undefined) {
2481
2508
  return undefined;
@@ -654,12 +654,13 @@ class coinex extends coinex$1 {
654
654
  // "id": null
655
655
  // }
656
656
  //
657
+ const isSwap = client.url.indexOf('perpetual') >= 0;
658
+ const marketType = isSwap ? 'swap' : 'spot';
657
659
  const params = this.safeValue(message, 'params', []);
658
660
  const fullOrderBook = this.safeValue(params, 0);
659
661
  let orderbook = this.safeValue(params, 1);
660
662
  const marketId = this.safeString(params, 2);
661
- const defaultType = this.safeString(this.options, 'defaultType');
662
- const market = this.safeMarket(marketId, undefined, undefined, defaultType);
663
+ const market = this.safeMarket(marketId, undefined, undefined, marketType);
663
664
  const symbol = market['symbol'];
664
665
  const name = 'orderbook';
665
666
  const messageHash = name + ':' + symbol;
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, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, 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, TransferEntries, LeverageTiers } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
7
- declare const version = "4.3.45";
7
+ declare const version = "4.3.46";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.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, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.3.46';
41
+ const version = '4.3.47';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -84,8 +84,8 @@ const truncate_to_string = (num, precision = 0) => {
84
84
  const truncate = (num, precision = 0) => parseFloat(truncate_to_string(num, precision));
85
85
  function precisionFromString(str) {
86
86
  // support string formats like '1e-4'
87
- if (str.indexOf('e') > -1) {
88
- const numStr = str.replace(/\de/, '');
87
+ if (str.indexOf('e') > -1 || str.indexOf('E') > -1) {
88
+ const numStr = str.replace(/\d\.?\d*[eE]/, '');
89
89
  return parseInt(numStr) * -1;
90
90
  }
91
91
  // support integer formats (without dot) like '1', '10' etc [Note: bug in decimalToPrecision, so this should not be used atm]
package/js/src/bitget.js CHANGED
@@ -4414,7 +4414,7 @@ export default class bitget extends Exchange {
4414
4414
  }
4415
4415
  if (marginMode !== undefined) {
4416
4416
  request['loanType'] = 'normal';
4417
- if (createMarketBuyOrderRequiresPrice && isMarketOrder && (side === 'buy')) {
4417
+ if (isMarketOrder && (side === 'buy')) {
4418
4418
  request['quoteSize'] = quantity;
4419
4419
  }
4420
4420
  else {
package/js/src/bitmart.js CHANGED
@@ -2333,7 +2333,7 @@ export default class bitmart extends Exchange {
2333
2333
  const trailingActivationPrice = this.safeNumber(order, 'activation_price');
2334
2334
  return this.safeOrder({
2335
2335
  'id': id,
2336
- 'clientOrderId': this.safeString(order, 'client_order_id'),
2336
+ 'clientOrderId': this.safeString2(order, 'client_order_id', 'clientOrderId'),
2337
2337
  'info': order,
2338
2338
  'timestamp': timestamp,
2339
2339
  'datetime': this.iso8601(timestamp),
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/hyperliquid.js';
2
- import type { Market, TransferEntry, Balances, Int, OrderBook, OHLCV, Str, FundingRateHistory, Order, OrderType, OrderSide, Trade, Strings, Position, OrderRequest, Dict, Num, MarginModification, Currencies, CancellationRequest, int, Transaction } from './base/types.js';
2
+ import type { Market, TransferEntry, Balances, Int, OrderBook, OHLCV, Str, FundingRateHistory, Order, OrderType, OrderSide, Trade, Strings, Position, OrderRequest, Dict, Num, MarginModification, Currencies, CancellationRequest, int, Transaction, Currency } from './base/types.js';
3
3
  /**
4
4
  * @class hyperliquid
5
5
  * @augments Exchange
@@ -78,6 +78,7 @@ export default class hyperliquid extends Exchange {
78
78
  parseMarginModification(data: Dict, market?: Market): MarginModification;
79
79
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
80
80
  withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
81
+ parseTransaction(transaction: Dict, currency?: Currency): Transaction;
81
82
  formatVaultAddress(address?: Str): string;
82
83
  handlePublicAddress(methodName: string, params: Dict): any[];
83
84
  coinToMarketId(coin: Str): string;
@@ -2479,6 +2479,33 @@ export default class hyperliquid extends Exchange {
2479
2479
  const response = await this.privatePostExchange(this.extend(request, params));
2480
2480
  return this.parseTransaction(response);
2481
2481
  }
2482
+ parseTransaction(transaction, currency = undefined) {
2483
+ //
2484
+ // { status: 'ok', response: { type: 'default' } }
2485
+ //
2486
+ return {
2487
+ 'info': transaction,
2488
+ 'id': undefined,
2489
+ 'txid': undefined,
2490
+ 'timestamp': undefined,
2491
+ 'datetime': undefined,
2492
+ 'network': undefined,
2493
+ 'address': undefined,
2494
+ 'addressTo': undefined,
2495
+ 'addressFrom': undefined,
2496
+ 'tag': undefined,
2497
+ 'tagTo': undefined,
2498
+ 'tagFrom': undefined,
2499
+ 'type': undefined,
2500
+ 'amount': undefined,
2501
+ 'currency': undefined,
2502
+ 'status': this.safeString(transaction, 'status'),
2503
+ 'updated': undefined,
2504
+ 'comment': undefined,
2505
+ 'internal': undefined,
2506
+ 'fee': undefined,
2507
+ };
2508
+ }
2482
2509
  formatVaultAddress(address = undefined) {
2483
2510
  if (address === undefined) {
2484
2511
  return undefined;
@@ -657,12 +657,13 @@ export default class coinex extends coinexRest {
657
657
  // "id": null
658
658
  // }
659
659
  //
660
+ const isSwap = client.url.indexOf('perpetual') >= 0;
661
+ const marketType = isSwap ? 'swap' : 'spot';
660
662
  const params = this.safeValue(message, 'params', []);
661
663
  const fullOrderBook = this.safeValue(params, 0);
662
664
  let orderbook = this.safeValue(params, 1);
663
665
  const marketId = this.safeString(params, 2);
664
- const defaultType = this.safeString(this.options, 'defaultType');
665
- const market = this.safeMarket(marketId, undefined, undefined, defaultType);
666
+ const market = this.safeMarket(marketId, undefined, undefined, marketType);
666
667
  const symbol = market['symbol'];
667
668
  const name = 'orderbook';
668
669
  const messageHash = name + ':' + symbol;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.46",
3
+ "version": "4.3.47",
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",