ccxt 4.1.100 → 4.2.1

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
@@ -169,7 +169,7 @@ var woo$1 = require('./src/pro/woo.js');
169
169
 
170
170
  //-----------------------------------------------------------------------------
171
171
  // this is updated by vss.js when building
172
- const version = '4.1.100';
172
+ const version = '4.2.1';
173
173
  Exchange["default"].ccxtVersion = version;
174
174
  const exchanges = {
175
175
  'ace': ace,
@@ -3221,14 +3221,13 @@ class bitget extends bitget$1 {
3221
3221
  // "1399132.341"
3222
3222
  // ]
3223
3223
  //
3224
- const volumeIndex = (market['inverse']) ? 6 : 5;
3225
3224
  return [
3226
3225
  this.safeInteger(ohlcv, 0),
3227
3226
  this.safeNumber(ohlcv, 1),
3228
3227
  this.safeNumber(ohlcv, 2),
3229
3228
  this.safeNumber(ohlcv, 3),
3230
3229
  this.safeNumber(ohlcv, 4),
3231
- this.safeNumber(ohlcv, volumeIndex),
3230
+ this.safeNumber(ohlcv, 5),
3232
3231
  ];
3233
3232
  }
3234
3233
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
@@ -3536,10 +3535,16 @@ class bitget extends bitget$1 {
3536
3535
  // Use transferable instead of available for swap and margin https://github.com/ccxt/ccxt/pull/19127
3537
3536
  const spotAccountFree = this.safeString(entry, 'available');
3538
3537
  const contractAccountFree = this.safeString(entry, 'maxTransferOut');
3539
- account['free'] = (contractAccountFree !== undefined) ? contractAccountFree : spotAccountFree;
3540
- const frozen = this.safeString(entry, 'frozen');
3541
- const locked = this.safeString(entry, 'locked');
3542
- account['used'] = Precise["default"].stringAdd(frozen, locked);
3538
+ if (contractAccountFree !== undefined) {
3539
+ account['free'] = contractAccountFree;
3540
+ account['total'] = this.safeString(entry, 'accountEquity');
3541
+ }
3542
+ else {
3543
+ account['free'] = spotAccountFree;
3544
+ const frozen = this.safeString(entry, 'frozen');
3545
+ const locked = this.safeString(entry, 'locked');
3546
+ account['used'] = Precise["default"].stringAdd(frozen, locked);
3547
+ }
3543
3548
  }
3544
3549
  result[code] = account;
3545
3550
  }
@@ -1168,14 +1168,16 @@ class cex extends cex$1 {
1168
1168
  */
1169
1169
  await this.loadMarkets();
1170
1170
  const request = {};
1171
- let method = 'privatePostOpenOrders';
1172
1171
  let market = undefined;
1172
+ let orders = undefined;
1173
1173
  if (symbol !== undefined) {
1174
1174
  market = this.market(symbol);
1175
1175
  request['pair'] = market['id'];
1176
- method += 'Pair';
1176
+ orders = await this.privatePostOpenOrdersPair(this.extend(request, params));
1177
+ }
1178
+ else {
1179
+ orders = await this.privatePostOpenOrders(this.extend(request, params));
1177
1180
  }
1178
- const orders = await this[method](this.extend(request, params));
1179
1181
  for (let i = 0; i < orders.length; i++) {
1180
1182
  orders[i] = this.extend(orders[i], { 'status': 'open' });
1181
1183
  }
@@ -1197,10 +1199,9 @@ class cex extends cex$1 {
1197
1199
  throw new errors.ArgumentsRequired(this.id + ' fetchClosedOrders() requires a symbol argument');
1198
1200
  }
1199
1201
  await this.loadMarkets();
1200
- const method = 'privatePostArchivedOrdersPair';
1201
1202
  const market = this.market(symbol);
1202
1203
  const request = { 'pair': market['id'] };
1203
- const response = await this[method](this.extend(request, params));
1204
+ const response = await this.privatePostArchivedOrdersPair(this.extend(request, params));
1204
1205
  return this.parseOrders(response, market, since, limit);
1205
1206
  }
1206
1207
  async fetchOrder(id, symbol = undefined, params = {}) {
@@ -1317,14 +1317,19 @@ class deribit extends deribit$1 {
1317
1317
  'instrument_name': market['id'],
1318
1318
  'include_old': true,
1319
1319
  };
1320
- const method = (since === undefined) ? 'publicGetGetLastTradesByInstrument' : 'publicGetGetLastTradesByInstrumentAndTime';
1321
1320
  if (since !== undefined) {
1322
1321
  request['start_timestamp'] = since;
1323
1322
  }
1324
1323
  if (limit !== undefined) {
1325
1324
  request['count'] = Math.min(limit, 1000); // default 10
1326
1325
  }
1327
- const response = await this[method](this.extend(request, params));
1326
+ let response = undefined;
1327
+ if (since === undefined) {
1328
+ response = await this.publicGetGetLastTradesByInstrument(this.extend(request, params));
1329
+ }
1330
+ else {
1331
+ response = await this.publicGetGetLastTradesByInstrumentAndTime(this.extend(request, params));
1332
+ }
1328
1333
  //
1329
1334
  // {
1330
1335
  // "jsonrpc":"2.0",
@@ -1821,9 +1826,14 @@ class deribit extends deribit$1 {
1821
1826
  request['time_in_force'] = 'fill_or_kill';
1822
1827
  }
1823
1828
  }
1824
- const method = 'privateGet' + this.capitalize(side);
1825
1829
  params = this.omit(params, ['timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'reduceOnly']);
1826
- const response = await this[method](this.extend(request, params));
1830
+ let response = undefined;
1831
+ if (this.capitalize(side) === 'Buy') {
1832
+ response = await this.privateGetBuy(this.extend(request, params));
1833
+ }
1834
+ else {
1835
+ response = await this.privateGetSell(this.extend(request, params));
1836
+ }
1827
1837
  //
1828
1838
  // {
1829
1839
  // "jsonrpc": "2.0",
@@ -1938,16 +1948,15 @@ class deribit extends deribit$1 {
1938
1948
  */
1939
1949
  await this.loadMarkets();
1940
1950
  const request = {};
1941
- let method = undefined;
1951
+ let response = undefined;
1942
1952
  if (symbol === undefined) {
1943
- method = 'privateGetCancelAll';
1953
+ response = await this.privateGetCancelAll(this.extend(request, params));
1944
1954
  }
1945
1955
  else {
1946
- method = 'privateGetCancelAllByInstrument';
1947
1956
  const market = this.market(symbol);
1948
1957
  request['instrument_name'] = market['id'];
1958
+ response = await this.privateGetCancelAllByInstrument(this.extend(request, params));
1949
1959
  }
1950
- const response = await this[method](this.extend(request, params));
1951
1960
  return response;
1952
1961
  }
1953
1962
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -1964,19 +1973,18 @@ class deribit extends deribit$1 {
1964
1973
  await this.loadMarkets();
1965
1974
  const request = {};
1966
1975
  let market = undefined;
1967
- let method = undefined;
1976
+ let response = undefined;
1968
1977
  if (symbol === undefined) {
1969
1978
  const code = this.codeFromOptions('fetchOpenOrders', params);
1970
1979
  const currency = this.currency(code);
1971
1980
  request['currency'] = currency['id'];
1972
- method = 'privateGetGetOpenOrdersByCurrency';
1981
+ response = await this.privateGetGetOpenOrdersByCurrency(this.extend(request, params));
1973
1982
  }
1974
1983
  else {
1975
1984
  market = this.market(symbol);
1976
1985
  request['instrument_name'] = market['id'];
1977
- method = 'privateGetGetOpenOrdersByInstrument';
1986
+ response = await this.privateGetGetOpenOrdersByInstrument(this.extend(request, params));
1978
1987
  }
1979
- const response = await this[method](this.extend(request, params));
1980
1988
  const result = this.safeValue(response, 'result', []);
1981
1989
  return this.parseOrders(result, market, since, limit);
1982
1990
  }
@@ -1994,19 +2002,18 @@ class deribit extends deribit$1 {
1994
2002
  await this.loadMarkets();
1995
2003
  const request = {};
1996
2004
  let market = undefined;
1997
- let method = undefined;
2005
+ let response = undefined;
1998
2006
  if (symbol === undefined) {
1999
2007
  const code = this.codeFromOptions('fetchClosedOrders', params);
2000
2008
  const currency = this.currency(code);
2001
2009
  request['currency'] = currency['id'];
2002
- method = 'privateGetGetOrderHistoryByCurrency';
2010
+ response = await this.privateGetGetOrderHistoryByCurrency(this.extend(request, params));
2003
2011
  }
2004
2012
  else {
2005
2013
  market = this.market(symbol);
2006
2014
  request['instrument_name'] = market['id'];
2007
- method = 'privateGetGetOrderHistoryByInstrument';
2015
+ response = await this.privateGetGetOrderHistoryByInstrument(this.extend(request, params));
2008
2016
  }
2009
- const response = await this[method](this.extend(request, params));
2010
2017
  const result = this.safeValue(response, 'result', []);
2011
2018
  return this.parseOrders(result, market, since, limit);
2012
2019
  }
@@ -2079,34 +2086,33 @@ class deribit extends deribit$1 {
2079
2086
  'include_old': true,
2080
2087
  };
2081
2088
  let market = undefined;
2082
- let method = undefined;
2089
+ if (limit !== undefined) {
2090
+ request['count'] = limit; // default 10
2091
+ }
2092
+ let response = undefined;
2083
2093
  if (symbol === undefined) {
2084
2094
  const code = this.codeFromOptions('fetchMyTrades', params);
2085
2095
  const currency = this.currency(code);
2086
2096
  request['currency'] = currency['id'];
2087
2097
  if (since === undefined) {
2088
- method = 'privateGetGetUserTradesByCurrency';
2098
+ response = await this.privateGetGetUserTradesByCurrency(this.extend(request, params));
2089
2099
  }
2090
2100
  else {
2091
- method = 'privateGetGetUserTradesByCurrencyAndTime';
2092
2101
  request['start_timestamp'] = since;
2102
+ response = await this.privateGetGetUserTradesByCurrencyAndTime(this.extend(request, params));
2093
2103
  }
2094
2104
  }
2095
2105
  else {
2096
2106
  market = this.market(symbol);
2097
2107
  request['instrument_name'] = market['id'];
2098
2108
  if (since === undefined) {
2099
- method = 'privateGetGetUserTradesByInstrument';
2109
+ response = await this.privateGetGetUserTradesByInstrument(this.extend(request, params));
2100
2110
  }
2101
2111
  else {
2102
- method = 'privateGetGetUserTradesByInstrumentAndTime';
2103
2112
  request['start_timestamp'] = since;
2113
+ response = await this.privateGetGetUserTradesByInstrumentAndTime(this.extend(request, params));
2104
2114
  }
2105
2115
  }
2106
- if (limit !== undefined) {
2107
- request['count'] = limit; // default 10
2108
- }
2109
- const response = await this[method](this.extend(request, params));
2110
2116
  //
2111
2117
  // {
2112
2118
  // "jsonrpc": "2.0",
@@ -2640,7 +2646,13 @@ class deribit extends deribit$1 {
2640
2646
  const transferOptions = this.safeValue(this.options, 'transfer', {});
2641
2647
  method = this.safeString(transferOptions, 'method', 'privateGetSubmitTransferToSubaccount');
2642
2648
  }
2643
- const response = await this[method](this.extend(request, params));
2649
+ let response = undefined;
2650
+ if (method === 'privateGetSubmitTransferToUser') {
2651
+ response = await this.privateGetSubmitTransferToUser(this.extend(request, params));
2652
+ }
2653
+ else {
2654
+ response = await this.privateGetSubmitTransferToSubaccount(this.extend(request, params));
2655
+ }
2644
2656
  //
2645
2657
  // {
2646
2658
  // "jsonrpc": "2.0",
@@ -1732,14 +1732,18 @@ class kucoinfutures extends kucoinfutures$1 {
1732
1732
  const cancelExist = this.safeValue(order, 'cancelExist', false);
1733
1733
  let status = isActive ? 'open' : 'closed';
1734
1734
  status = cancelExist ? 'canceled' : status;
1735
- const fee = {
1736
- 'currency': feeCurrency,
1737
- 'cost': feeCost,
1738
- };
1735
+ let fee = undefined;
1736
+ if (feeCost !== undefined) {
1737
+ fee = {
1738
+ 'currency': feeCurrency,
1739
+ 'cost': feeCost,
1740
+ };
1741
+ }
1739
1742
  const clientOrderId = this.safeString(order, 'clientOid');
1740
1743
  const timeInForce = this.safeString(order, 'timeInForce');
1741
1744
  const stopPrice = this.safeNumber(order, 'stopPrice');
1742
1745
  const postOnly = this.safeValue(order, 'postOnly');
1746
+ const reduceOnly = this.safeValue(order, 'reduceOnly');
1743
1747
  const lastUpdateTimestamp = this.safeInteger(order, 'updatedAt');
1744
1748
  return this.safeOrder({
1745
1749
  'id': orderId,
@@ -1748,6 +1752,7 @@ class kucoinfutures extends kucoinfutures$1 {
1748
1752
  'type': type,
1749
1753
  'timeInForce': timeInForce,
1750
1754
  'postOnly': postOnly,
1755
+ 'reduceOnly': reduceOnly,
1751
1756
  'side': side,
1752
1757
  'amount': amount,
1753
1758
  'price': price,
@@ -51,7 +51,7 @@ class bitmart extends bitmart$1 {
51
51
  'awaitBalanceSnapshot': false, // whether to wait for the balance snapshot before providing updates
52
52
  },
53
53
  'watchOrderBook': {
54
- 'depth': 'depth50', // depth5, depth20, depth50
54
+ 'depth': 'depth/increase100', // depth/increase100, depth5, depth20, depth50
55
55
  },
56
56
  'ws': {
57
57
  'inflate': true,
@@ -1069,6 +1069,7 @@ class bitmart extends bitmart$1 {
1069
1069
  * @method
1070
1070
  * @name bitmart#watchOrderBook
1071
1071
  * @see https://developer-pro.bitmart.com/en/spot/#public-depth-all-channel
1072
+ * @see https://developer-pro.bitmart.com/en/spot/#public-depth-increase-channel
1072
1073
  * @see https://developer-pro.bitmart.com/en/futures/#public-depth-channel
1073
1074
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
1074
1075
  * @param {string} symbol unified symbol of the market to fetch the order book for
@@ -1078,11 +1079,14 @@ class bitmart extends bitmart$1 {
1078
1079
  */
1079
1080
  await this.loadMarkets();
1080
1081
  const options = this.safeValue(this.options, 'watchOrderBook', {});
1081
- const depth = this.safeString(options, 'depth', 'depth50');
1082
+ let depth = this.safeString(options, 'depth', 'depth/increase100');
1082
1083
  symbol = this.symbol(symbol);
1083
1084
  const market = this.market(symbol);
1084
1085
  let type = 'spot';
1085
1086
  [type, params] = this.handleMarketTypeAndParams('watchOrderBook', market, params);
1087
+ if (type === 'swap' && depth === 'depth/increase100') {
1088
+ depth = 'depth50';
1089
+ }
1086
1090
  const orderbook = await this.subscribe(depth, symbol, type, params);
1087
1091
  return orderbook.limit();
1088
1092
  }
@@ -1131,46 +1135,72 @@ class bitmart extends bitmart$1 {
1131
1135
  }
1132
1136
  handleOrderBook(client, message) {
1133
1137
  //
1134
- // spot
1135
- // {
1136
- // "data": [
1137
- // {
1138
- // "asks": [
1139
- // [ '46828.38', "0.21847" ],
1140
- // [ '46830.68', "0.08232" ],
1141
- // ...
1142
- // ],
1143
- // "bids": [
1144
- // [ '46820.78', "0.00444" ],
1145
- // [ '46814.33', "0.00234" ],
1146
- // ...
1138
+ // spot depth-all
1139
+ // {
1140
+ // "data": [
1141
+ // {
1142
+ // "asks": [
1143
+ // [ '46828.38', "0.21847" ],
1144
+ // [ '46830.68', "0.08232" ],
1145
+ // ...
1146
+ // ],
1147
+ // "bids": [
1148
+ // [ '46820.78', "0.00444" ],
1149
+ // [ '46814.33', "0.00234" ],
1150
+ // ...
1151
+ // ],
1152
+ // "ms_t": 1631044962431,
1153
+ // "symbol": "BTC_USDT"
1154
+ // }
1155
+ // ],
1156
+ // "table": "spot/depth5"
1157
+ // }
1158
+ // spot increse depth snapshot
1159
+ // {
1160
+ // "data":[
1161
+ // {
1162
+ // "asks":[
1163
+ // [
1164
+ // "43652.52",
1165
+ // "0.02039"
1147
1166
  // ],
1148
- // "ms_t": 1631044962431,
1149
- // "symbol": "BTC_USDT"
1150
- // }
1151
- // ],
1152
- // "table": "spot/depth5"
1153
- // }
1167
+ // ...
1168
+ // ],
1169
+ // "bids":[
1170
+ // [
1171
+ // "43652.51",
1172
+ // "0.00500"
1173
+ // ],
1174
+ // ...
1175
+ // ],
1176
+ // "ms_t":1703376836487,
1177
+ // "symbol":"BTC_USDT",
1178
+ // "type":"snapshot", // or update
1179
+ // "version":2141731
1180
+ // }
1181
+ // ],
1182
+ // "table":"spot/depth/increase100"
1183
+ // }
1154
1184
  // swap
1155
- // {
1156
- // "group":"futures/depth50:BTCUSDT",
1157
- // "data":{
1158
- // "symbol":"BTCUSDT",
1159
- // "way":1,
1160
- // "depths":[
1161
- // {
1162
- // "price":"39509.8",
1163
- // "vol":"2379"
1164
- // },
1165
- // {
1166
- // "price":"39509.6",
1167
- // "vol":"6815"
1168
- // },
1169
- // ...
1170
- // ],
1171
- // "ms_t":1701566021194
1172
- // }
1173
- // }
1185
+ // {
1186
+ // "group":"futures/depth50:BTCUSDT",
1187
+ // "data":{
1188
+ // "symbol":"BTCUSDT",
1189
+ // "way":1,
1190
+ // "depths":[
1191
+ // {
1192
+ // "price":"39509.8",
1193
+ // "vol":"2379"
1194
+ // },
1195
+ // {
1196
+ // "price":"39509.6",
1197
+ // "vol":"6815"
1198
+ // },
1199
+ // ...
1200
+ // ],
1201
+ // "ms_t":1701566021194
1202
+ // }
1203
+ // }
1174
1204
  //
1175
1205
  const data = this.safeValue(message, 'data');
1176
1206
  if (data === undefined) {
@@ -1179,12 +1209,16 @@ class bitmart extends bitmart$1 {
1179
1209
  const depths = this.safeValue(data, 'depths');
1180
1210
  const isSpot = (depths === undefined);
1181
1211
  const table = this.safeString2(message, 'table', 'group');
1182
- const parts = table.split('/');
1183
- const lastPart = this.safeString(parts, 1);
1184
- let limitString = lastPart.replace('depth', '');
1185
- const dotsIndex = limitString.indexOf(':');
1186
- limitString = limitString.slice(0, dotsIndex);
1187
- const limit = this.parseToInt(limitString);
1212
+ // find limit subscribed to
1213
+ const limitsToCheck = ['100', '50', '20', '10', '5'];
1214
+ let limit = 0;
1215
+ for (let i = 0; i < limitsToCheck.length; i++) {
1216
+ const limitString = limitsToCheck[i];
1217
+ if (table.indexOf(limitString) >= 0) {
1218
+ limit = this.parseToInt(limitString);
1219
+ break;
1220
+ }
1221
+ }
1188
1222
  if (isSpot) {
1189
1223
  for (let i = 0; i < data.length; i++) {
1190
1224
  const update = data[i];
@@ -1196,7 +1230,10 @@ class bitmart extends bitmart$1 {
1196
1230
  orderbook['symbol'] = symbol;
1197
1231
  this.orderbooks[symbol] = orderbook;
1198
1232
  }
1199
- orderbook.reset({});
1233
+ const type = this.safeValue(update, 'type');
1234
+ if ((type === 'snapshot') || (!(table.indexOf('increase') >= 0))) {
1235
+ orderbook.reset({});
1236
+ }
1200
1237
  this.handleOrderBookMessage(client, update, orderbook);
1201
1238
  const timestamp = this.safeInteger(update, 'ms_t');
1202
1239
  orderbook['timestamp'] = timestamp;
@@ -1388,9 +1425,7 @@ class bitmart extends bitmart$1 {
1388
1425
  }
1389
1426
  else {
1390
1427
  const methods = {
1391
- 'depth5': this.handleOrderBook,
1392
- 'depth20': this.handleOrderBook,
1393
- 'depth50': this.handleOrderBook,
1428
+ 'depth': this.handleOrderBook,
1394
1429
  'ticker': this.handleTicker,
1395
1430
  'trade': this.handleTrade,
1396
1431
  'kline': this.handleOHLCV,
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 { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } 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, NoChange } from './src/base/errors.js';
7
- declare const version = "4.1.99";
7
+ declare const version = "4.2.0";
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, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.1.100';
41
+ const version = '4.2.1';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
package/js/src/bitget.js CHANGED
@@ -3224,14 +3224,13 @@ export default class bitget extends Exchange {
3224
3224
  // "1399132.341"
3225
3225
  // ]
3226
3226
  //
3227
- const volumeIndex = (market['inverse']) ? 6 : 5;
3228
3227
  return [
3229
3228
  this.safeInteger(ohlcv, 0),
3230
3229
  this.safeNumber(ohlcv, 1),
3231
3230
  this.safeNumber(ohlcv, 2),
3232
3231
  this.safeNumber(ohlcv, 3),
3233
3232
  this.safeNumber(ohlcv, 4),
3234
- this.safeNumber(ohlcv, volumeIndex),
3233
+ this.safeNumber(ohlcv, 5),
3235
3234
  ];
3236
3235
  }
3237
3236
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
@@ -3539,10 +3538,16 @@ export default class bitget extends Exchange {
3539
3538
  // Use transferable instead of available for swap and margin https://github.com/ccxt/ccxt/pull/19127
3540
3539
  const spotAccountFree = this.safeString(entry, 'available');
3541
3540
  const contractAccountFree = this.safeString(entry, 'maxTransferOut');
3542
- account['free'] = (contractAccountFree !== undefined) ? contractAccountFree : spotAccountFree;
3543
- const frozen = this.safeString(entry, 'frozen');
3544
- const locked = this.safeString(entry, 'locked');
3545
- account['used'] = Precise.stringAdd(frozen, locked);
3541
+ if (contractAccountFree !== undefined) {
3542
+ account['free'] = contractAccountFree;
3543
+ account['total'] = this.safeString(entry, 'accountEquity');
3544
+ }
3545
+ else {
3546
+ account['free'] = spotAccountFree;
3547
+ const frozen = this.safeString(entry, 'frozen');
3548
+ const locked = this.safeString(entry, 'locked');
3549
+ account['used'] = Precise.stringAdd(frozen, locked);
3550
+ }
3546
3551
  }
3547
3552
  result[code] = account;
3548
3553
  }
package/js/src/cex.js CHANGED
@@ -1171,14 +1171,16 @@ export default class cex extends Exchange {
1171
1171
  */
1172
1172
  await this.loadMarkets();
1173
1173
  const request = {};
1174
- let method = 'privatePostOpenOrders';
1175
1174
  let market = undefined;
1175
+ let orders = undefined;
1176
1176
  if (symbol !== undefined) {
1177
1177
  market = this.market(symbol);
1178
1178
  request['pair'] = market['id'];
1179
- method += 'Pair';
1179
+ orders = await this.privatePostOpenOrdersPair(this.extend(request, params));
1180
+ }
1181
+ else {
1182
+ orders = await this.privatePostOpenOrders(this.extend(request, params));
1180
1183
  }
1181
- const orders = await this[method](this.extend(request, params));
1182
1184
  for (let i = 0; i < orders.length; i++) {
1183
1185
  orders[i] = this.extend(orders[i], { 'status': 'open' });
1184
1186
  }
@@ -1200,10 +1202,9 @@ export default class cex extends Exchange {
1200
1202
  throw new ArgumentsRequired(this.id + ' fetchClosedOrders() requires a symbol argument');
1201
1203
  }
1202
1204
  await this.loadMarkets();
1203
- const method = 'privatePostArchivedOrdersPair';
1204
1205
  const market = this.market(symbol);
1205
1206
  const request = { 'pair': market['id'] };
1206
- const response = await this[method](this.extend(request, params));
1207
+ const response = await this.privatePostArchivedOrdersPair(this.extend(request, params));
1207
1208
  return this.parseOrders(response, market, since, limit);
1208
1209
  }
1209
1210
  async fetchOrder(id, symbol = undefined, params = {}) {