ccxt 4.3.78 → 4.3.79

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.
@@ -2067,7 +2067,7 @@ export default class binance extends binanceRest {
2067
2067
  * @param {string|undefined} [params.type] 'future', 'delivery', 'savings', 'funding', or 'spot'
2068
2068
  * @param {string|undefined} [params.marginMode] 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null
2069
2069
  * @param {string[]|undefined} [params.symbols] unified market symbols, only used in isolated margin mode
2070
- * @param {string|undefined} [params.method] method to use. Can be account.balance or account.status
2070
+ * @param {string|undefined} [params.method] method to use. Can be account.balance, account.status, v2/account.balance or v2/account.status
2071
2071
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
2072
2072
  */
2073
2073
  await this.loadMarkets();
@@ -2099,8 +2099,16 @@ export default class binance extends binanceRest {
2099
2099
  //
2100
2100
  //
2101
2101
  const messageHash = this.safeString(message, 'id');
2102
- const result = this.safeDict(message, 'result', {});
2103
- const rawBalance = this.safeList(result, 0, []);
2102
+ let rawBalance = undefined;
2103
+ if (Array.isArray(message['result'])) {
2104
+ // account.balance
2105
+ rawBalance = this.safeList(message, 'result', []);
2106
+ }
2107
+ else {
2108
+ // account.status
2109
+ const result = this.safeDict(message, 'result', {});
2110
+ rawBalance = this.safeList(result, 'assets', []);
2111
+ }
2104
2112
  const parsedBalances = this.parseBalanceCustom(rawBalance);
2105
2113
  client.resolve(parsedBalances, messageHash);
2106
2114
  }
@@ -2177,6 +2185,7 @@ export default class binance extends binanceRest {
2177
2185
  * @param {string[]} [symbols] list of unified market symbols
2178
2186
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2179
2187
  * @param {boolean} [params.returnRateLimits] set to true to return rate limit informations, defaults to false.
2188
+ * @param {string|undefined} [params.method] method to use. Can be account.position or v2/account.position
2180
2189
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
2181
2190
  */
2182
2191
  await this.loadMarkets();
@@ -2194,9 +2203,11 @@ export default class binance extends binanceRest {
2194
2203
  let returnRateLimits = false;
2195
2204
  [returnRateLimits, params] = this.handleOptionAndParams(params, 'fetchPositionsWs', 'returnRateLimits', false);
2196
2205
  payload['returnRateLimits'] = returnRateLimits;
2206
+ let method = undefined;
2207
+ [method, params] = this.handleOptionAndParams(params, 'fetchPositionsWs', 'method', 'account.position');
2197
2208
  const message = {
2198
2209
  'id': messageHash,
2199
- 'method': 'account.position',
2210
+ 'method': method,
2200
2211
  'params': this.signParams(this.extend(payload, params)),
2201
2212
  };
2202
2213
  const subscription = {
@@ -3294,7 +3305,7 @@ export default class binance extends binanceRest {
3294
3305
  this.setBalanceCache(client, type, isPortfolioMargin);
3295
3306
  this.setPositionsCache(client, type, symbols, isPortfolioMargin);
3296
3307
  const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
3297
- const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
3308
+ const awaitPositionsSnapshot = this.handleOption('watchPositions', 'awaitPositionsSnapshot', true);
3298
3309
  const cache = this.safeValue(this.positions, type);
3299
3310
  if (fetchPositionsSnapshot && awaitPositionsSnapshot && cache === undefined) {
3300
3311
  const snapshot = await client.future(type + ':fetchPositionsSnapshot');
@@ -1130,7 +1130,7 @@ export default class bybit extends bybitRest {
1130
1130
  this.setPositionsCache(client, symbols);
1131
1131
  const cache = this.positions;
1132
1132
  const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
1133
- const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
1133
+ const awaitPositionsSnapshot = this.handleOption('watchPositions', 'awaitPositionsSnapshot', true);
1134
1134
  if (fetchPositionsSnapshot && awaitPositionsSnapshot && cache === undefined) {
1135
1135
  const snapshot = await client.future('fetchPositionsSnapshot');
1136
1136
  return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
@@ -564,7 +564,7 @@ export default class cryptocom extends cryptocomRest {
564
564
  const client = this.client(url);
565
565
  this.setPositionsCache(client, symbols);
566
566
  const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
567
- const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
567
+ const awaitPositionsSnapshot = this.handleOption('watchPositions', 'awaitPositionsSnapshot', true);
568
568
  if (fetchPositionsSnapshot && awaitPositionsSnapshot && this.positions === undefined) {
569
569
  const snapshot = await client.future('fetchPositionsSnapshot');
570
570
  return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
@@ -1089,7 +1089,7 @@ export default class gate extends gateRest {
1089
1089
  const client = this.client(url);
1090
1090
  this.setPositionsCache(client, type, symbols);
1091
1091
  const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
1092
- const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
1092
+ const awaitPositionsSnapshot = this.handleOption('watchPositions', 'awaitPositionsSnapshot', true);
1093
1093
  const cache = this.safeValue(this.positions, type);
1094
1094
  if (fetchPositionsSnapshot && awaitPositionsSnapshot && cache === undefined) {
1095
1095
  return await client.future(type + ':fetchPositionsSnapshot');
@@ -354,7 +354,7 @@ export default class kucoinfutures extends kucoinfuturesRest {
354
354
  const client = this.client(url);
355
355
  this.setPositionCache(client, symbol);
356
356
  const fetchPositionSnapshot = this.handleOption('watchPosition', 'fetchPositionSnapshot', true);
357
- const awaitPositionSnapshot = this.safeBool('watchPosition', 'awaitPositionSnapshot', true);
357
+ const awaitPositionSnapshot = this.handleOption('watchPosition', 'awaitPositionSnapshot', true);
358
358
  const currentPosition = this.getCurrentPosition(symbol);
359
359
  if (fetchPositionSnapshot && awaitPositionSnapshot && currentPosition === undefined) {
360
360
  const snapshot = await client.future('fetchPositionSnapshot:' + symbol);
@@ -575,7 +575,7 @@ export default class vertex extends vertexRest {
575
575
  const client = this.client(url);
576
576
  this.setPositionsCache(client, symbols, params);
577
577
  const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
578
- const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
578
+ const awaitPositionsSnapshot = this.handleOption('watchPositions', 'awaitPositionsSnapshot', true);
579
579
  if (fetchPositionsSnapshot && awaitPositionsSnapshot && this.positions === undefined) {
580
580
  const snapshot = await client.future('fetchPositionsSnapshot');
581
581
  return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
package/js/src/pro/woo.js CHANGED
@@ -971,7 +971,7 @@ export default class woo extends wooRest {
971
971
  const client = this.client(url);
972
972
  this.setPositionsCache(client, symbols);
973
973
  const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
974
- const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
974
+ const awaitPositionsSnapshot = this.handleOption('watchPositions', 'awaitPositionsSnapshot', true);
975
975
  if (fetchPositionsSnapshot && awaitPositionsSnapshot && this.positions === undefined) {
976
976
  const snapshot = await client.future('fetchPositionsSnapshot');
977
977
  return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
@@ -915,7 +915,7 @@ export default class woofipro extends woofiproRest {
915
915
  const client = this.client(url);
916
916
  this.setPositionsCache(client, symbols);
917
917
  const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
918
- const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
918
+ const awaitPositionsSnapshot = this.handleOption('watchPositions', 'awaitPositionsSnapshot', true);
919
919
  if (fetchPositionsSnapshot && awaitPositionsSnapshot && this.positions === undefined) {
920
920
  const snapshot = await client.future('fetchPositionsSnapshot');
921
921
  return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.78",
3
+ "version": "4.3.79",
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",