ccxt 4.2.45 → 4.2.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.
Files changed (90) hide show
  1. package/CHANGELOG.md +5405 -8414
  2. package/README.md +4 -4
  3. package/change.sh +5 -3
  4. package/dist/ccxt.browser.js +824 -64
  5. package/dist/ccxt.browser.min.js +7 -7
  6. package/dist/cjs/ccxt.js +1 -1
  7. package/dist/cjs/src/base/ws/Cache.js +13 -5
  8. package/dist/cjs/src/base/ws/OrderBook.js +2 -2
  9. package/dist/cjs/src/binance.js +34 -12
  10. package/dist/cjs/src/bitfinex2.js +1 -0
  11. package/dist/cjs/src/bithumb.js +5 -0
  12. package/dist/cjs/src/btcturk.js +11 -0
  13. package/dist/cjs/src/bybit.js +185 -2
  14. package/dist/cjs/src/coinbase.js +9 -5
  15. package/dist/cjs/src/coincheck.js +11 -0
  16. package/dist/cjs/src/coinmate.js +114 -1
  17. package/dist/cjs/src/coinsph.js +32 -1
  18. package/dist/cjs/src/coinspot.js +7 -0
  19. package/dist/cjs/src/cryptocom.js +2 -2
  20. package/dist/cjs/src/currencycom.js +22 -0
  21. package/dist/cjs/src/deribit.js +34 -1
  22. package/dist/cjs/src/exmo.js +22 -0
  23. package/dist/cjs/src/gemini.js +15 -0
  24. package/dist/cjs/src/hitbtc.js +2 -0
  25. package/dist/cjs/src/hollaex.js +27 -1
  26. package/dist/cjs/src/idex.js +60 -1
  27. package/dist/cjs/src/indodax.js +106 -1
  28. package/dist/cjs/src/latoken.js +3 -0
  29. package/dist/cjs/src/mercado.js +3 -0
  30. package/dist/cjs/src/oceanex.js +3 -0
  31. package/dist/cjs/src/okx.js +1 -0
  32. package/dist/cjs/src/pro/bitget.js +12 -8
  33. package/dist/cjs/src/pro/bitmart.js +11 -11
  34. package/dist/cjs/src/pro/bitmex.js +4 -4
  35. package/dist/cjs/src/pro/cex.js +2 -2
  36. package/dist/cjs/src/pro/gemini.js +4 -3
  37. package/dist/cjs/src/timex.js +65 -0
  38. package/js/ccxt.d.ts +1 -1
  39. package/js/ccxt.js +1 -1
  40. package/js/src/abstract/bequant.d.ts +2 -0
  41. package/js/src/abstract/bitcoincom.d.ts +2 -0
  42. package/js/src/abstract/bithumb.d.ts +5 -0
  43. package/js/src/abstract/coinmate.d.ts +12 -0
  44. package/js/src/abstract/fmfwio.d.ts +2 -0
  45. package/js/src/abstract/hitbtc.d.ts +2 -0
  46. package/js/src/abstract/hitbtc3.d.ts +2 -0
  47. package/js/src/abstract/hollaex.d.ts +3 -0
  48. package/js/src/abstract/okx.d.ts +1 -0
  49. package/js/src/base/Exchange.d.ts +9 -7
  50. package/js/src/base/ws/Cache.d.ts +5 -1
  51. package/js/src/base/ws/Cache.js +13 -5
  52. package/js/src/base/ws/OrderBook.d.ts +5 -1
  53. package/js/src/base/ws/OrderBook.js +3 -3
  54. package/js/src/binance.d.ts +1 -1
  55. package/js/src/binance.js +34 -12
  56. package/js/src/bitfinex2.js +1 -0
  57. package/js/src/bithumb.js +5 -0
  58. package/js/src/btcturk.js +11 -0
  59. package/js/src/bybit.d.ts +2 -0
  60. package/js/src/bybit.js +185 -2
  61. package/js/src/coinbase.js +9 -5
  62. package/js/src/coincheck.js +11 -0
  63. package/js/src/coinmate.d.ts +3 -1
  64. package/js/src/coinmate.js +114 -1
  65. package/js/src/coinsph.js +32 -1
  66. package/js/src/coinspot.js +7 -0
  67. package/js/src/cryptocom.js +2 -2
  68. package/js/src/currencycom.js +22 -0
  69. package/js/src/deribit.js +34 -1
  70. package/js/src/exmo.js +22 -0
  71. package/js/src/gemini.js +15 -0
  72. package/js/src/hitbtc.js +2 -0
  73. package/js/src/hollaex.js +27 -1
  74. package/js/src/idex.d.ts +14 -0
  75. package/js/src/idex.js +60 -1
  76. package/js/src/indodax.d.ts +3 -0
  77. package/js/src/indodax.js +106 -1
  78. package/js/src/latoken.js +3 -0
  79. package/js/src/mercado.js +3 -0
  80. package/js/src/oceanex.js +3 -0
  81. package/js/src/okx.js +1 -0
  82. package/js/src/pro/bitget.js +12 -8
  83. package/js/src/pro/bitmart.js +11 -11
  84. package/js/src/pro/bitmex.js +4 -4
  85. package/js/src/pro/cex.js +2 -2
  86. package/js/src/pro/gemini.js +4 -3
  87. package/js/src/timex.d.ts +14 -0
  88. package/js/src/timex.js +65 -0
  89. package/package.json +1 -1
  90. package/skip-tests.json +4 -0
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.2.44";
7
+ declare const version = "4.2.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, 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.2.45';
41
+ const version = '4.2.47';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -17,6 +17,8 @@ interface hitbtc {
17
17
  publicGetPublicOrderbookSymbol(params?: {}): Promise<implicitReturnType>;
18
18
  publicGetPublicCandles(params?: {}): Promise<implicitReturnType>;
19
19
  publicGetPublicCandlesSymbol(params?: {}): Promise<implicitReturnType>;
20
+ publicGetPublicConvertedCandles(params?: {}): Promise<implicitReturnType>;
21
+ publicGetPublicConvertedCandlesSymbol(params?: {}): Promise<implicitReturnType>;
20
22
  publicGetPublicFuturesInfo(params?: {}): Promise<implicitReturnType>;
21
23
  publicGetPublicFuturesInfoSymbol(params?: {}): Promise<implicitReturnType>;
22
24
  publicGetPublicFuturesHistoryFunding(params?: {}): Promise<implicitReturnType>;
@@ -17,6 +17,8 @@ interface fmfwio {
17
17
  publicGetPublicOrderbookSymbol(params?: {}): Promise<implicitReturnType>;
18
18
  publicGetPublicCandles(params?: {}): Promise<implicitReturnType>;
19
19
  publicGetPublicCandlesSymbol(params?: {}): Promise<implicitReturnType>;
20
+ publicGetPublicConvertedCandles(params?: {}): Promise<implicitReturnType>;
21
+ publicGetPublicConvertedCandlesSymbol(params?: {}): Promise<implicitReturnType>;
20
22
  publicGetPublicFuturesInfo(params?: {}): Promise<implicitReturnType>;
21
23
  publicGetPublicFuturesInfoSymbol(params?: {}): Promise<implicitReturnType>;
22
24
  publicGetPublicFuturesHistoryFunding(params?: {}): Promise<implicitReturnType>;
@@ -6,6 +6,11 @@ interface Exchange {
6
6
  publicGetOrderbookALLQuoteId(params?: {}): Promise<implicitReturnType>;
7
7
  publicGetOrderbookBaseIdQuoteId(params?: {}): Promise<implicitReturnType>;
8
8
  publicGetTransactionHistoryBaseIdQuoteId(params?: {}): Promise<implicitReturnType>;
9
+ publicGetNetworkInfo(params?: {}): Promise<implicitReturnType>;
10
+ publicGetAssetsstatusMultichainALL(params?: {}): Promise<implicitReturnType>;
11
+ publicGetAssetsstatusMultichainCurrency(params?: {}): Promise<implicitReturnType>;
12
+ publicGetWithdrawMinimumALL(params?: {}): Promise<implicitReturnType>;
13
+ publicGetWithdrawMinimumCurrency(params?: {}): Promise<implicitReturnType>;
9
14
  publicGetAssetsstatusALL(params?: {}): Promise<implicitReturnType>;
10
15
  publicGetAssetsstatusBaseId(params?: {}): Promise<implicitReturnType>;
11
16
  publicGetCandlestickBaseIdQuoteIdInterval(params?: {}): Promise<implicitReturnType>;
@@ -3,6 +3,8 @@ import { Exchange as _Exchange } from '../base/Exchange.js';
3
3
  interface Exchange {
4
4
  publicGetOrderBook(params?: {}): Promise<implicitReturnType>;
5
5
  publicGetTicker(params?: {}): Promise<implicitReturnType>;
6
+ publicGetTickerAll(params?: {}): Promise<implicitReturnType>;
7
+ publicGetProducts(params?: {}): Promise<implicitReturnType>;
6
8
  publicGetTransactions(params?: {}): Promise<implicitReturnType>;
7
9
  publicGetTradingPairs(params?: {}): Promise<implicitReturnType>;
8
10
  privatePostBalances(params?: {}): Promise<implicitReturnType>;
@@ -47,6 +49,16 @@ interface Exchange {
47
49
  privatePostUnconfirmedEthereumDeposits(params?: {}): Promise<implicitReturnType>;
48
50
  privatePostUnconfirmedLitecoinDeposits(params?: {}): Promise<implicitReturnType>;
49
51
  privatePostUnconfirmedRippleDeposits(params?: {}): Promise<implicitReturnType>;
52
+ privatePostCancelAllOpenOrders(params?: {}): Promise<implicitReturnType>;
53
+ privatePostWithdrawVirtualCurrency(params?: {}): Promise<implicitReturnType>;
54
+ privatePostVirtualCurrencyDepositAddresses(params?: {}): Promise<implicitReturnType>;
55
+ privatePostUnconfirmedVirtualCurrencyDeposits(params?: {}): Promise<implicitReturnType>;
56
+ privatePostAdaWithdrawal(params?: {}): Promise<implicitReturnType>;
57
+ privatePostAdaDepositAddresses(params?: {}): Promise<implicitReturnType>;
58
+ privatePostUnconfirmedAdaDeposits(params?: {}): Promise<implicitReturnType>;
59
+ privatePostSolWithdrawal(params?: {}): Promise<implicitReturnType>;
60
+ privatePostSolDepositAddresses(params?: {}): Promise<implicitReturnType>;
61
+ privatePostUnconfirmedSolDeposits(params?: {}): Promise<implicitReturnType>;
50
62
  }
51
63
  declare abstract class Exchange extends _Exchange {
52
64
  }
@@ -17,6 +17,8 @@ interface hitbtc {
17
17
  publicGetPublicOrderbookSymbol(params?: {}): Promise<implicitReturnType>;
18
18
  publicGetPublicCandles(params?: {}): Promise<implicitReturnType>;
19
19
  publicGetPublicCandlesSymbol(params?: {}): Promise<implicitReturnType>;
20
+ publicGetPublicConvertedCandles(params?: {}): Promise<implicitReturnType>;
21
+ publicGetPublicConvertedCandlesSymbol(params?: {}): Promise<implicitReturnType>;
20
22
  publicGetPublicFuturesInfo(params?: {}): Promise<implicitReturnType>;
21
23
  publicGetPublicFuturesInfoSymbol(params?: {}): Promise<implicitReturnType>;
22
24
  publicGetPublicFuturesHistoryFunding(params?: {}): Promise<implicitReturnType>;
@@ -17,6 +17,8 @@ interface Exchange {
17
17
  publicGetPublicOrderbookSymbol(params?: {}): Promise<implicitReturnType>;
18
18
  publicGetPublicCandles(params?: {}): Promise<implicitReturnType>;
19
19
  publicGetPublicCandlesSymbol(params?: {}): Promise<implicitReturnType>;
20
+ publicGetPublicConvertedCandles(params?: {}): Promise<implicitReturnType>;
21
+ publicGetPublicConvertedCandlesSymbol(params?: {}): Promise<implicitReturnType>;
20
22
  publicGetPublicFuturesInfo(params?: {}): Promise<implicitReturnType>;
21
23
  publicGetPublicFuturesInfoSymbol(params?: {}): Promise<implicitReturnType>;
22
24
  publicGetPublicFuturesHistoryFunding(params?: {}): Promise<implicitReturnType>;
@@ -17,6 +17,8 @@ interface hitbtc {
17
17
  publicGetPublicOrderbookSymbol(params?: {}): Promise<implicitReturnType>;
18
18
  publicGetPublicCandles(params?: {}): Promise<implicitReturnType>;
19
19
  publicGetPublicCandlesSymbol(params?: {}): Promise<implicitReturnType>;
20
+ publicGetPublicConvertedCandles(params?: {}): Promise<implicitReturnType>;
21
+ publicGetPublicConvertedCandlesSymbol(params?: {}): Promise<implicitReturnType>;
20
22
  publicGetPublicFuturesInfo(params?: {}): Promise<implicitReturnType>;
21
23
  publicGetPublicFuturesInfoSymbol(params?: {}): Promise<implicitReturnType>;
22
24
  publicGetPublicFuturesHistoryFunding(params?: {}): Promise<implicitReturnType>;
@@ -12,6 +12,9 @@ interface Exchange {
12
12
  publicGetTrades(params?: {}): Promise<implicitReturnType>;
13
13
  publicGetChart(params?: {}): Promise<implicitReturnType>;
14
14
  publicGetCharts(params?: {}): Promise<implicitReturnType>;
15
+ publicGetMinicharts(params?: {}): Promise<implicitReturnType>;
16
+ publicGetOraclePrices(params?: {}): Promise<implicitReturnType>;
17
+ publicGetQuickTrade(params?: {}): Promise<implicitReturnType>;
15
18
  publicGetUdfConfig(params?: {}): Promise<implicitReturnType>;
16
19
  publicGetUdfHistory(params?: {}): Promise<implicitReturnType>;
17
20
  publicGetUdfSymbols(params?: {}): Promise<implicitReturnType>;
@@ -245,6 +245,7 @@ interface Exchange {
245
245
  privatePostAccountQuickMarginBorrowRepay(params?: {}): Promise<implicitReturnType>;
246
246
  privatePostAccountBorrowRepay(params?: {}): Promise<implicitReturnType>;
247
247
  privatePostAccountSimulatedMargin(params?: {}): Promise<implicitReturnType>;
248
+ privatePostAccountPositionBuilder(params?: {}): Promise<implicitReturnType>;
248
249
  privatePostAccountSetRiskOffsetType(params?: {}): Promise<implicitReturnType>;
249
250
  privatePostAccountActivateOption(params?: {}): Promise<implicitReturnType>;
250
251
  privatePostAccountSetAutoLoan(params?: {}): Promise<implicitReturnType>;
@@ -5,6 +5,8 @@ import WsClient from './ws/WsClient.js';
5
5
  import { OrderBook as WsOrderBook, IndexedOrderBook, CountedOrderBook } from './ws/OrderBook.js';
6
6
  import type { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRate, DepositWithdrawFeeNetwork, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Str, Num, MarketInterface, CurrencyInterface, Account } from './types.js';
7
7
  export type { Market, Trade, Fee, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRateHistory, Liquidation, FundingHistory, Greeks } from './types.js';
8
+ import { ArrayCache } from './ws/Cache.js';
9
+ import { OrderBook as Ob } from './ws/OrderBook.js';
8
10
  /**
9
11
  * @class Exchange
10
12
  */
@@ -73,15 +75,15 @@ export default class Exchange {
73
75
  walletAddress: string;
74
76
  token: string;
75
77
  balance: {};
76
- orderbooks: {};
77
- tickers: {};
78
- bidsasks: {};
79
- orders: any;
80
- triggerOrders: any;
81
- trades: any;
78
+ orderbooks: Dictionary<Ob>;
79
+ tickers: Dictionary<Ticker>;
80
+ bidsasks: Dictionary<Ticker>;
81
+ orders: ArrayCache;
82
+ triggerOrders: ArrayCache;
83
+ trades: Dictionary<ArrayCache>;
82
84
  transactions: {};
83
85
  ohlcvs: any;
84
- myTrades: any;
86
+ myTrades: ArrayCache;
85
87
  positions: any;
86
88
  urls: {
87
89
  logo?: string;
@@ -1,8 +1,12 @@
1
+ interface CustomArray extends Array {
2
+ hashmap: object;
3
+ }
1
4
  declare class BaseCache extends Array {
2
5
  constructor(maxSize?: any);
3
6
  clear(): void;
4
7
  }
5
- declare class ArrayCache extends BaseCache {
8
+ declare class ArrayCache extends BaseCache implements CustomArray {
9
+ hashmap: object;
6
10
  constructor(maxSize?: any);
7
11
  getLimit(symbol: any, limit: any): any;
8
12
  append(item: any): void;
@@ -22,6 +22,7 @@ class BaseCache extends Array {
22
22
  class ArrayCache extends BaseCache {
23
23
  constructor(maxSize = undefined) {
24
24
  super(maxSize);
25
+ this.hashmap = {};
25
26
  Object.defineProperty(this, 'nestedNewUpdatesBySymbol', {
26
27
  __proto__: null,
27
28
  value: false,
@@ -47,6 +48,12 @@ class ArrayCache extends BaseCache {
47
48
  value: false,
48
49
  writable: true,
49
50
  });
51
+ Object.defineProperty(this, 'hashmap', {
52
+ __proto__: null,
53
+ value: {},
54
+ writable: true,
55
+ enumerable: false,
56
+ });
50
57
  }
51
58
  getLimit(symbol, limit) {
52
59
  let newUpdatesValue = undefined;
@@ -126,6 +133,7 @@ class ArrayCacheByTimestamp extends BaseCache {
126
133
  if (item[0] in this.hashmap) {
127
134
  const reference = this.hashmap[item[0]];
128
135
  if (reference !== item) {
136
+ // eslint-disable-next-line
129
137
  for (const prop in item) {
130
138
  reference[prop] = item[prop];
131
139
  }
@@ -151,11 +159,11 @@ class ArrayCacheBySymbolById extends ArrayCache {
151
159
  constructor(maxSize = undefined) {
152
160
  super(maxSize);
153
161
  this.nestedNewUpdatesBySymbol = true;
154
- Object.defineProperty(this, 'hashmap', {
155
- __proto__: null,
156
- value: {},
157
- writable: true,
158
- });
162
+ // Object.defineProperty (this, 'hashmap', {
163
+ // __proto__: null, // make it invisible
164
+ // value: {},
165
+ // writable: true,
166
+ // })
159
167
  }
160
168
  append(item) {
161
169
  const byId = this.hashmap[item.symbol] = this.hashmap[item.symbol] || {};
@@ -1,4 +1,8 @@
1
- declare class OrderBook {
1
+ interface CustomOrderBookProp {
2
+ cache: any[];
3
+ }
4
+ declare class OrderBook implements CustomOrderBookProp {
5
+ cache: any[];
2
6
  constructor(snapshot?: {}, depth?: any);
3
7
  limit(): this;
4
8
  update(snapshot: any): this;
@@ -5,7 +5,7 @@
5
5
  // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
6
 
7
7
  /* eslint-disable max-classes-per-file */
8
- // @ts-nocheck
8
+ // @ts-nocheck
9
9
  import { iso8601 } from '../../base/functions/time.js';
10
10
  import { extend } from '../../base/functions/generic.js';
11
11
  import { Asks, Bids, CountedAsks, CountedBids, IndexedAsks, IndexedBids,
@@ -14,14 +14,14 @@ import { Asks, Bids, CountedAsks, CountedBids, IndexedAsks, IndexedBids,
14
14
  // IncrementalIndexedAsks,
15
15
  // IncrementalIndexedBids, // check this
16
16
  } from './OrderBookSide.js';
17
- // ----------------------------------------------------------------------------
18
- // overwrites absolute volumes at price levels
19
17
  class OrderBook {
20
18
  constructor(snapshot = {}, depth = undefined) {
19
+ this.cache = []; // make prop visible so we use typed OrderBooks
21
20
  Object.defineProperty(this, 'cache', {
22
21
  __proto__: null,
23
22
  value: [],
24
23
  writable: true,
24
+ enumerable: false,
25
25
  });
26
26
  depth = depth || Number.MAX_SAFE_INTEGER;
27
27
  const defaults = {
@@ -21,7 +21,7 @@ export default class binance extends Exchange {
21
21
  fetchMarkets(params?: {}): Promise<any[]>;
22
22
  parseMarket(market: any): Market;
23
23
  parseBalanceHelper(entry: any): import("./base/types.js").Account;
24
- parseBalanceCustom(response: any, type?: any, marginMode?: any): Balances;
24
+ parseBalanceCustom(response: any, type?: any, marginMode?: any, isPortfolioMargin?: boolean): Balances;
25
25
  fetchBalance(params?: {}): Promise<Balances>;
26
26
  fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
27
27
  parseTicker(ticker: any, market?: Market): Ticker;
package/js/src/binance.js CHANGED
@@ -3161,25 +3161,38 @@ export default class binance extends Exchange {
3161
3161
  account['debt'] = Precise.stringAdd(debt, interest);
3162
3162
  return account;
3163
3163
  }
3164
- parseBalanceCustom(response, type = undefined, marginMode = undefined) {
3164
+ parseBalanceCustom(response, type = undefined, marginMode = undefined, isPortfolioMargin = false) {
3165
3165
  const result = {
3166
3166
  'info': response,
3167
3167
  };
3168
3168
  let timestamp = undefined;
3169
3169
  const isolated = marginMode === 'isolated';
3170
3170
  const cross = (type === 'margin') || (marginMode === 'cross');
3171
- if (type === 'papi') {
3171
+ if (isPortfolioMargin) {
3172
3172
  for (let i = 0; i < response.length; i++) {
3173
3173
  const entry = response[i];
3174
3174
  const account = this.account();
3175
3175
  const currencyId = this.safeString(entry, 'asset');
3176
3176
  const code = this.safeCurrencyCode(currencyId);
3177
- const borrowed = this.safeString(entry, 'crossMarginBorrowed');
3178
- const interest = this.safeString(entry, 'crossMarginInterest');
3179
- account['free'] = this.safeString(entry, 'crossMarginFree');
3180
- account['used'] = this.safeString(entry, 'crossMarginLocked');
3181
- account['total'] = this.safeString(entry, 'crossMarginAsset');
3182
- account['debt'] = Precise.stringAdd(borrowed, interest);
3177
+ if (type === 'linear') {
3178
+ account['free'] = this.safeString(entry, 'umWalletBalance');
3179
+ account['used'] = this.safeString(entry, 'umUnrealizedPNL');
3180
+ }
3181
+ else if (type === 'inverse') {
3182
+ account['free'] = this.safeString(entry, 'cmWalletBalance');
3183
+ account['used'] = this.safeString(entry, 'cmUnrealizedPNL');
3184
+ }
3185
+ else if (cross) {
3186
+ const borrowed = this.safeString(entry, 'crossMarginBorrowed');
3187
+ const interest = this.safeString(entry, 'crossMarginInterest');
3188
+ account['debt'] = Precise.stringAdd(borrowed, interest);
3189
+ account['free'] = this.safeString(entry, 'crossMarginFree');
3190
+ account['used'] = this.safeString(entry, 'crossMarginLocked');
3191
+ account['total'] = this.safeString(entry, 'crossMarginAsset');
3192
+ }
3193
+ else {
3194
+ account['total'] = this.safeString(entry, 'totalWalletBalance');
3195
+ }
3183
3196
  result[code] = account;
3184
3197
  }
3185
3198
  }
@@ -3299,7 +3312,13 @@ export default class binance extends Exchange {
3299
3312
  let response = undefined;
3300
3313
  const request = {};
3301
3314
  if (isPortfolioMargin || (type === 'papi')) {
3302
- type = 'papi';
3315
+ if (this.isLinear(type, subType)) {
3316
+ type = 'linear';
3317
+ }
3318
+ else if (this.isInverse(type, subType)) {
3319
+ type = 'inverse';
3320
+ }
3321
+ isPortfolioMargin = true;
3303
3322
  response = await this.papiGetBalance(this.extend(request, query));
3304
3323
  }
3305
3324
  else if (this.isLinear(type, subType)) {
@@ -3547,7 +3566,7 @@ export default class binance extends Exchange {
3547
3566
  // },
3548
3567
  // ]
3549
3568
  //
3550
- return this.parseBalanceCustom(response, type, marginMode);
3569
+ return this.parseBalanceCustom(response, type, marginMode, isPortfolioMargin);
3551
3570
  }
3552
3571
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
3553
3572
  /**
@@ -9830,12 +9849,12 @@ export default class binance extends Exchange {
9830
9849
  /**
9831
9850
  * @method
9832
9851
  * @name binance#fetchPositions
9852
+ * @description fetch all open positions
9833
9853
  * @see https://binance-docs.github.io/apidocs/futures/en/#position-information-v2-user_data
9834
9854
  * @see https://binance-docs.github.io/apidocs/delivery/en/#position-information-user_data
9835
9855
  * @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
9836
9856
  * @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
9837
9857
  * @see https://binance-docs.github.io/apidocs/voptions/en/#option-position-information-user_data
9838
- * @description fetch all open positions
9839
9858
  * @param {string[]} [symbols] list of unified market symbols
9840
9859
  * @param {object} [params] extra parameters specific to the exchange API endpoint
9841
9860
  * @param {string} [method] method name to call, "positionRisk", "account" or "option", default is "positionRisk"
@@ -10059,7 +10078,10 @@ export default class binance extends Exchange {
10059
10078
  const result = [];
10060
10079
  for (let i = 0; i < response.length; i++) {
10061
10080
  const parsed = this.parsePositionRisk(response[i]);
10062
- result.push(parsed);
10081
+ const entryPrice = this.safeString(parsed, 'entryPrice');
10082
+ if ((entryPrice !== '0') && (entryPrice !== '0.0') && (entryPrice !== '0.00000000')) {
10083
+ result.push(parsed);
10084
+ }
10063
10085
  }
10064
10086
  symbols = this.marketSymbols(symbols);
10065
10087
  return this.filterByArrayPositions(result, 'symbol', symbols, false);
@@ -409,6 +409,7 @@ export default class bitfinex2 extends Exchange {
409
409
  'EDO': 'PNT',
410
410
  'EUS': 'EURS',
411
411
  'EUT': 'EURT',
412
+ 'HTX': 'HT',
412
413
  'IDX': 'ID',
413
414
  'IOT': 'IOTA',
414
415
  'IQX': 'IQ',
package/js/src/bithumb.js CHANGED
@@ -91,6 +91,11 @@ export default class bithumb extends Exchange {
91
91
  'orderbook/ALL_{quoteId}',
92
92
  'orderbook/{baseId}_{quoteId}',
93
93
  'transaction_history/{baseId}_{quoteId}',
94
+ 'network-info',
95
+ 'assetsstatus/multichain/ALL',
96
+ 'assetsstatus/multichain/{currency}',
97
+ 'withdraw/minimum/ALL',
98
+ 'withdraw/minimum/{currency}',
94
99
  'assetsstatus/ALL',
95
100
  'assetsstatus/{baseId}',
96
101
  'candlestick/{baseId}_{quoteId}/{interval}',
package/js/src/btcturk.js CHANGED
@@ -147,6 +147,7 @@ export default class btcturk extends Exchange {
147
147
  * @method
148
148
  * @name btcturk#fetchMarkets
149
149
  * @description retrieves data on all markets for btcturk
150
+ * @see https://docs.btcturk.com/public-endpoints/exchange-info
150
151
  * @param {object} [params] extra parameters specific to the exchange API endpoint
151
152
  * @returns {object[]} an array of objects representing market data
152
153
  */
@@ -296,6 +297,7 @@ export default class btcturk extends Exchange {
296
297
  * @method
297
298
  * @name btcturk#fetchBalance
298
299
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
300
+ * @see https://docs.btcturk.com/private-endpoints/account-balance
299
301
  * @param {object} [params] extra parameters specific to the exchange API endpoint
300
302
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
301
303
  */
@@ -324,6 +326,7 @@ export default class btcturk extends Exchange {
324
326
  * @method
325
327
  * @name btcturk#fetchOrderBook
326
328
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
329
+ * @see https://docs.btcturk.com/public-endpoints/orderbook
327
330
  * @param {string} symbol unified symbol of the market to fetch the order book for
328
331
  * @param {int} [limit] the maximum amount of order book entries to return
329
332
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -404,6 +407,7 @@ export default class btcturk extends Exchange {
404
407
  * @method
405
408
  * @name btcturk#fetchTickers
406
409
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
410
+ * @see https://docs.btcturk.com/public-endpoints/ticker
407
411
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
408
412
  * @param {object} [params] extra parameters specific to the exchange API endpoint
409
413
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -418,6 +422,7 @@ export default class btcturk extends Exchange {
418
422
  * @method
419
423
  * @name btcturk#fetchTicker
420
424
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
425
+ * @see https://docs.btcturk.com/public-endpoints/ticker
421
426
  * @param {string} symbol unified symbol of the market to fetch the ticker for
422
427
  * @param {object} [params] extra parameters specific to the exchange API endpoint
423
428
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -493,6 +498,7 @@ export default class btcturk extends Exchange {
493
498
  * @method
494
499
  * @name btcturk#fetchTrades
495
500
  * @description get the list of most recent trades for a particular symbol
501
+ * @see https://docs.btcturk.com/public-endpoints/trades
496
502
  * @param {string} symbol unified symbol of the market to fetch trades for
497
503
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
498
504
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -656,6 +662,7 @@ export default class btcturk extends Exchange {
656
662
  * @method
657
663
  * @name btcturk#createOrder
658
664
  * @description create a trade order
665
+ * @see https://docs.btcturk.com/private-endpoints/submit-order
659
666
  * @param {string} symbol unified symbol of the market to create an order in
660
667
  * @param {string} type 'market' or 'limit'
661
668
  * @param {string} side 'buy' or 'sell'
@@ -690,6 +697,7 @@ export default class btcturk extends Exchange {
690
697
  * @method
691
698
  * @name btcturk#cancelOrder
692
699
  * @description cancels an open order
700
+ * @see https://docs.btcturk.com/private-endpoints/cancel-order
693
701
  * @param {string} id order id
694
702
  * @param {string} symbol not used by btcturk cancelOrder ()
695
703
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -705,6 +713,7 @@ export default class btcturk extends Exchange {
705
713
  * @method
706
714
  * @name btcturk#fetchOpenOrders
707
715
  * @description fetch all unfilled currently open orders
716
+ * @see https://docs.btcturk.com/private-endpoints/open-orders
708
717
  * @param {string} symbol unified market symbol
709
718
  * @param {int} [since] the earliest time in ms to fetch open orders for
710
719
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -729,6 +738,7 @@ export default class btcturk extends Exchange {
729
738
  * @method
730
739
  * @name btcturk#fetchOrders
731
740
  * @description fetches information on multiple orders made by the user
741
+ * @see https://docs.btcturk.com/private-endpoints/all-orders
732
742
  * @param {string} symbol unified market symbol of the market orders were made in
733
743
  * @param {int} [since] the earliest time in ms to fetch orders for
734
744
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -851,6 +861,7 @@ export default class btcturk extends Exchange {
851
861
  * @method
852
862
  * @name btcturk#fetchMyTrades
853
863
  * @description fetch all trades made by the user
864
+ * @see https://docs.btcturk.com/private-endpoints/user-transactions
854
865
  * @param {string} symbol unified market symbol
855
866
  * @param {int} [since] the earliest time in ms to fetch trades for
856
867
  * @param {int} [limit] the maximum number of trades structures to retrieve
package/js/src/bybit.d.ts CHANGED
@@ -69,8 +69,10 @@ export default class bybit extends Exchange {
69
69
  cancelAllUsdcOrders(symbol?: Str, params?: {}): Promise<any>;
70
70
  cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
71
71
  fetchUsdcOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
72
+ fetchOrderClassic(id: string, symbol?: Str, params?: {}): Promise<Order>;
72
73
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
73
74
  fetchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
75
+ fetchOrdersClassic(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
74
76
  fetchClosedOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
75
77
  fetchOpenOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
76
78
  fetchCanceledAndClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;