ccxt 4.0.85 → 4.0.86

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
@@ -180,7 +180,7 @@ var woo$1 = require('./src/pro/woo.js');
180
180
 
181
181
  //-----------------------------------------------------------------------------
182
182
  // this is updated by vss.js when building
183
- const version = '4.0.85';
183
+ const version = '4.0.86';
184
184
  Exchange["default"].ccxtVersion = version;
185
185
  const exchanges = {
186
186
  'ace': ace,
@@ -2562,6 +2562,8 @@ class bitget extends bitget$1 {
2562
2562
  /**
2563
2563
  * @method
2564
2564
  * @name bitget#fetchBalance
2565
+ * @see https://bitgetlimited.github.io/apidoc/en/spot/#get-account-assets
2566
+ * @see https://bitgetlimited.github.io/apidoc/en/mix/#get-account-list
2565
2567
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
2566
2568
  * @param {object} [params] extra parameters specific to the bitget api endpoint
2567
2569
  * @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
@@ -2626,13 +2628,32 @@ class bitget extends bitget$1 {
2626
2628
  parseBalance(balance) {
2627
2629
  const result = { 'info': balance };
2628
2630
  //
2631
+ // spot
2632
+ //
2633
+ // {
2634
+ // coinId: '1',
2635
+ // coinName: 'BTC',
2636
+ // available: '0.00099900',
2637
+ // frozen: '0.00000000',
2638
+ // lock: '0.00000000',
2639
+ // uTime: '1661595535000'
2640
+ // }
2641
+ //
2642
+ // swap
2643
+ //
2629
2644
  // {
2630
- // coinId: '1',
2631
- // coinName: 'BTC',
2632
- // available: '0.00099900',
2633
- // frozen: '0.00000000',
2634
- // lock: '0.00000000',
2635
- // uTime: '1661595535000'
2645
+ // marginCoin: 'BTC',
2646
+ // locked: '0.00001948',
2647
+ // available: '0.00006622',
2648
+ // crossMaxAvailable: '0.00004674',
2649
+ // fixedMaxAvailable: '0.00004674',
2650
+ // maxTransferOut: '0.00004674',
2651
+ // equity: '0.00006622',
2652
+ // usdtEquity: '1.734307497491',
2653
+ // btcEquity: '0.000066229058',
2654
+ // crossRiskRate: '0.066308887072',
2655
+ // unrealizedPL: '0',
2656
+ // bonus: '0'
2636
2657
  // }
2637
2658
  //
2638
2659
  for (let i = 0; i < balance.length; i++) {
@@ -2640,10 +2661,12 @@ class bitget extends bitget$1 {
2640
2661
  const currencyId = this.safeString2(entry, 'coinName', 'marginCoin');
2641
2662
  const code = this.safeCurrencyCode(currencyId);
2642
2663
  const account = this.account();
2664
+ const spotAccountFree = this.safeString(entry, 'available');
2665
+ const contractAccountFree = this.safeString(entry, 'maxTransferOut');
2666
+ account['free'] = (contractAccountFree !== undefined) ? contractAccountFree : spotAccountFree;
2643
2667
  const frozen = this.safeString(entry, 'frozen');
2644
2668
  const locked = this.safeString2(entry, 'lock', 'locked');
2645
2669
  account['used'] = Precise["default"].stringAdd(frozen, locked);
2646
- account['free'] = this.safeString(entry, 'available');
2647
2670
  result[code] = account;
2648
2671
  }
2649
2672
  return this.safeBalance(result);
@@ -1125,11 +1125,18 @@ class kucoinfutures extends kucoinfutures$1 {
1125
1125
  'leverage': 1,
1126
1126
  };
1127
1127
  const [triggerPrice, stopLossPrice, takeProfitPrice] = this.handleTriggerPrices(params);
1128
+ const triggerPriceTypes = {
1129
+ 'mark': 'MP',
1130
+ 'last': 'TP',
1131
+ 'index': 'IP',
1132
+ };
1133
+ const triggerPriceType = this.safeString(params, 'triggerPriceType', 'mark');
1134
+ const triggerPriceTypeValue = this.safeString(triggerPriceTypes, triggerPriceType, triggerPriceType);
1128
1135
  params = this.omit(params, ['stopLossPrice', 'takeProfitPrice', 'triggerPrice', 'stopPrice']);
1129
1136
  if (triggerPrice) {
1130
1137
  request['stop'] = (side === 'buy') ? 'up' : 'down';
1131
1138
  request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
1132
- request['stopPriceType'] = 'MP';
1139
+ request['stopPriceType'] = triggerPriceTypeValue;
1133
1140
  }
1134
1141
  else if (stopLossPrice || takeProfitPrice) {
1135
1142
  if (stopLossPrice) {
@@ -1141,7 +1148,7 @@ class kucoinfutures extends kucoinfutures$1 {
1141
1148
  request['stopPrice'] = this.priceToPrecision(symbol, takeProfitPrice);
1142
1149
  }
1143
1150
  request['reduceOnly'] = true;
1144
- request['stopPriceType'] = 'MP';
1151
+ request['stopPriceType'] = triggerPriceTypeValue;
1145
1152
  }
1146
1153
  const uppercaseType = type.toUpperCase();
1147
1154
  const timeInForce = this.safeStringUpper(params, 'timeInForce');
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 { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending } from './src/base/errors.js';
7
- declare const version = "4.0.84";
7
+ declare const version = "4.0.85";
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, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.0.85';
41
+ const version = '4.0.86';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
package/js/src/bitget.js CHANGED
@@ -2565,6 +2565,8 @@ export default class bitget extends Exchange {
2565
2565
  /**
2566
2566
  * @method
2567
2567
  * @name bitget#fetchBalance
2568
+ * @see https://bitgetlimited.github.io/apidoc/en/spot/#get-account-assets
2569
+ * @see https://bitgetlimited.github.io/apidoc/en/mix/#get-account-list
2568
2570
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
2569
2571
  * @param {object} [params] extra parameters specific to the bitget api endpoint
2570
2572
  * @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
@@ -2629,13 +2631,32 @@ export default class bitget extends Exchange {
2629
2631
  parseBalance(balance) {
2630
2632
  const result = { 'info': balance };
2631
2633
  //
2634
+ // spot
2635
+ //
2636
+ // {
2637
+ // coinId: '1',
2638
+ // coinName: 'BTC',
2639
+ // available: '0.00099900',
2640
+ // frozen: '0.00000000',
2641
+ // lock: '0.00000000',
2642
+ // uTime: '1661595535000'
2643
+ // }
2644
+ //
2645
+ // swap
2646
+ //
2632
2647
  // {
2633
- // coinId: '1',
2634
- // coinName: 'BTC',
2635
- // available: '0.00099900',
2636
- // frozen: '0.00000000',
2637
- // lock: '0.00000000',
2638
- // uTime: '1661595535000'
2648
+ // marginCoin: 'BTC',
2649
+ // locked: '0.00001948',
2650
+ // available: '0.00006622',
2651
+ // crossMaxAvailable: '0.00004674',
2652
+ // fixedMaxAvailable: '0.00004674',
2653
+ // maxTransferOut: '0.00004674',
2654
+ // equity: '0.00006622',
2655
+ // usdtEquity: '1.734307497491',
2656
+ // btcEquity: '0.000066229058',
2657
+ // crossRiskRate: '0.066308887072',
2658
+ // unrealizedPL: '0',
2659
+ // bonus: '0'
2639
2660
  // }
2640
2661
  //
2641
2662
  for (let i = 0; i < balance.length; i++) {
@@ -2643,10 +2664,12 @@ export default class bitget extends Exchange {
2643
2664
  const currencyId = this.safeString2(entry, 'coinName', 'marginCoin');
2644
2665
  const code = this.safeCurrencyCode(currencyId);
2645
2666
  const account = this.account();
2667
+ const spotAccountFree = this.safeString(entry, 'available');
2668
+ const contractAccountFree = this.safeString(entry, 'maxTransferOut');
2669
+ account['free'] = (contractAccountFree !== undefined) ? contractAccountFree : spotAccountFree;
2646
2670
  const frozen = this.safeString(entry, 'frozen');
2647
2671
  const locked = this.safeString2(entry, 'lock', 'locked');
2648
2672
  account['used'] = Precise.stringAdd(frozen, locked);
2649
- account['free'] = this.safeString(entry, 'available');
2650
2673
  result[code] = account;
2651
2674
  }
2652
2675
  return this.safeBalance(result);
@@ -1128,11 +1128,18 @@ export default class kucoinfutures extends kucoin {
1128
1128
  'leverage': 1,
1129
1129
  };
1130
1130
  const [triggerPrice, stopLossPrice, takeProfitPrice] = this.handleTriggerPrices(params);
1131
+ const triggerPriceTypes = {
1132
+ 'mark': 'MP',
1133
+ 'last': 'TP',
1134
+ 'index': 'IP',
1135
+ };
1136
+ const triggerPriceType = this.safeString(params, 'triggerPriceType', 'mark');
1137
+ const triggerPriceTypeValue = this.safeString(triggerPriceTypes, triggerPriceType, triggerPriceType);
1131
1138
  params = this.omit(params, ['stopLossPrice', 'takeProfitPrice', 'triggerPrice', 'stopPrice']);
1132
1139
  if (triggerPrice) {
1133
1140
  request['stop'] = (side === 'buy') ? 'up' : 'down';
1134
1141
  request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
1135
- request['stopPriceType'] = 'MP';
1142
+ request['stopPriceType'] = triggerPriceTypeValue;
1136
1143
  }
1137
1144
  else if (stopLossPrice || takeProfitPrice) {
1138
1145
  if (stopLossPrice) {
@@ -1144,7 +1151,7 @@ export default class kucoinfutures extends kucoin {
1144
1151
  request['stopPrice'] = this.priceToPrecision(symbol, takeProfitPrice);
1145
1152
  }
1146
1153
  request['reduceOnly'] = true;
1147
- request['stopPriceType'] = 'MP';
1154
+ request['stopPriceType'] = triggerPriceTypeValue;
1148
1155
  }
1149
1156
  const uppercaseType = type.toUpperCase();
1150
1157
  const timeInForce = this.safeStringUpper(params, 'timeInForce');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.0.85",
3
+ "version": "4.0.86",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 130+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",