ccxt 4.3.6 → 4.3.8

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 (196) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/ccxt.js +1 -1
  3. package/dist/cjs/src/ace.js +5 -0
  4. package/dist/cjs/src/alpaca.js +6 -0
  5. package/dist/cjs/src/base/Exchange.js +47 -3
  6. package/dist/cjs/src/binance.js +3 -1
  7. package/dist/cjs/src/bingx.js +3 -1
  8. package/dist/cjs/src/bitbank.js +3 -0
  9. package/dist/cjs/src/bitget.js +75 -2
  10. package/dist/cjs/src/bithumb.js +4 -0
  11. package/dist/cjs/src/bitmex.js +2 -0
  12. package/dist/cjs/src/bitopro.js +5 -0
  13. package/dist/cjs/src/bitso.js +3 -0
  14. package/dist/cjs/src/bitstamp.js +3 -0
  15. package/dist/cjs/src/bitteam.js +4 -0
  16. package/dist/cjs/src/bitvavo.js +3 -0
  17. package/dist/cjs/src/bl3p.js +3 -0
  18. package/dist/cjs/src/btcalpha.js +3 -0
  19. package/dist/cjs/src/btcbox.js +3 -0
  20. package/dist/cjs/src/btcmarkets.js +3 -0
  21. package/dist/cjs/src/btcturk.js +3 -0
  22. package/dist/cjs/src/bybit.js +123 -12
  23. package/dist/cjs/src/cex.js +6 -0
  24. package/dist/cjs/src/coinbase.js +95 -17
  25. package/dist/cjs/src/coinbaseinternational.js +2 -0
  26. package/dist/cjs/src/coinbasepro.js +6 -0
  27. package/dist/cjs/src/coincheck.js +3 -0
  28. package/dist/cjs/src/coinex.js +257 -190
  29. package/dist/cjs/src/coinlist.js +4 -0
  30. package/dist/cjs/src/coinmate.js +3 -0
  31. package/dist/cjs/src/coinone.js +3 -0
  32. package/dist/cjs/src/coinsph.js +4 -0
  33. package/dist/cjs/src/coinspot.js +3 -0
  34. package/dist/cjs/src/cryptocom.js +2 -0
  35. package/dist/cjs/src/exmo.js +5 -0
  36. package/dist/cjs/src/gate.js +124 -22
  37. package/dist/cjs/src/hitbtc.js +4 -3
  38. package/dist/cjs/src/htx.js +2 -0
  39. package/dist/cjs/src/idex.js +3 -0
  40. package/dist/cjs/src/independentreserve.js +3 -0
  41. package/dist/cjs/src/indodax.js +3 -0
  42. package/dist/cjs/src/kucoin.js +2 -0
  43. package/dist/cjs/src/kucoinfutures.js +2 -0
  44. package/dist/cjs/src/latoken.js +6 -0
  45. package/dist/cjs/src/luno.js +3 -0
  46. package/dist/cjs/src/lykke.js +5 -0
  47. package/dist/cjs/src/mercado.js +3 -0
  48. package/dist/cjs/src/mexc.js +111 -0
  49. package/dist/cjs/src/ndax.js +4 -0
  50. package/dist/cjs/src/novadax.js +4 -0
  51. package/dist/cjs/src/okx.js +84 -1
  52. package/dist/cjs/src/onetrading.js +3 -0
  53. package/dist/cjs/src/p2b.js +3 -0
  54. package/dist/cjs/src/pro/bybit.js +1 -1
  55. package/dist/cjs/src/pro/coinbase.js +30 -29
  56. package/dist/cjs/src/probit.js +3 -0
  57. package/dist/cjs/src/timex.js +3 -0
  58. package/dist/cjs/src/tradeogre.js +3 -0
  59. package/dist/cjs/src/wavesexchange.js +3 -0
  60. package/dist/cjs/src/wazirx.js +3 -0
  61. package/dist/cjs/src/woo.js +3 -1
  62. package/dist/cjs/src/yobit.js +3 -0
  63. package/js/ccxt.d.ts +1 -1
  64. package/js/ccxt.js +1 -1
  65. package/js/src/abstract/coinbase.d.ts +5 -0
  66. package/js/src/ace.js +5 -0
  67. package/js/src/alpaca.js +6 -0
  68. package/js/src/ascendex.d.ts +2 -2
  69. package/js/src/base/Exchange.d.ts +23 -19
  70. package/js/src/base/Exchange.js +47 -3
  71. package/js/src/base/functions/generic.d.ts +20 -19
  72. package/js/src/bigone.d.ts +1 -1
  73. package/js/src/binance.d.ts +3 -3
  74. package/js/src/binance.js +3 -1
  75. package/js/src/bingx.d.ts +3 -3
  76. package/js/src/bingx.js +3 -1
  77. package/js/src/bitbank.d.ts +1 -1
  78. package/js/src/bitbank.js +3 -0
  79. package/js/src/bitfinex.d.ts +1 -1
  80. package/js/src/bitfinex2.d.ts +1 -1
  81. package/js/src/bitflyer.d.ts +1 -1
  82. package/js/src/bitget.d.ts +4 -3
  83. package/js/src/bitget.js +75 -2
  84. package/js/src/bithumb.d.ts +1 -1
  85. package/js/src/bithumb.js +4 -0
  86. package/js/src/bitmart.d.ts +1 -1
  87. package/js/src/bitmex.d.ts +1 -1
  88. package/js/src/bitmex.js +2 -0
  89. package/js/src/bitopro.d.ts +1 -1
  90. package/js/src/bitopro.js +5 -0
  91. package/js/src/bitrue.d.ts +1 -1
  92. package/js/src/bitso.d.ts +1 -1
  93. package/js/src/bitso.js +3 -0
  94. package/js/src/bitstamp.d.ts +1 -1
  95. package/js/src/bitstamp.js +3 -0
  96. package/js/src/bitteam.js +4 -0
  97. package/js/src/bitvavo.d.ts +1 -1
  98. package/js/src/bitvavo.js +3 -0
  99. package/js/src/bl3p.js +3 -0
  100. package/js/src/blockchaincom.d.ts +1 -1
  101. package/js/src/btcalpha.js +3 -0
  102. package/js/src/btcbox.js +3 -0
  103. package/js/src/btcmarkets.d.ts +1 -1
  104. package/js/src/btcmarkets.js +3 -0
  105. package/js/src/btcturk.js +3 -0
  106. package/js/src/bybit.d.ts +8 -7
  107. package/js/src/bybit.js +123 -12
  108. package/js/src/cex.js +6 -0
  109. package/js/src/coinbase.d.ts +2 -2
  110. package/js/src/coinbase.js +95 -17
  111. package/js/src/coinbaseinternational.d.ts +2 -2
  112. package/js/src/coinbaseinternational.js +2 -0
  113. package/js/src/coinbasepro.d.ts +1 -1
  114. package/js/src/coinbasepro.js +6 -0
  115. package/js/src/coincheck.js +3 -0
  116. package/js/src/coinex.d.ts +8 -7
  117. package/js/src/coinex.js +257 -190
  118. package/js/src/coinlist.d.ts +1 -1
  119. package/js/src/coinlist.js +4 -0
  120. package/js/src/coinmate.d.ts +1 -1
  121. package/js/src/coinmate.js +3 -0
  122. package/js/src/coinone.js +3 -0
  123. package/js/src/coinsph.d.ts +1 -1
  124. package/js/src/coinsph.js +4 -0
  125. package/js/src/coinspot.js +3 -0
  126. package/js/src/cryptocom.d.ts +1 -1
  127. package/js/src/cryptocom.js +2 -0
  128. package/js/src/delta.d.ts +2 -2
  129. package/js/src/deribit.d.ts +1 -1
  130. package/js/src/digifinex.d.ts +3 -3
  131. package/js/src/exmo.d.ts +3 -3
  132. package/js/src/exmo.js +5 -0
  133. package/js/src/gate.d.ts +8 -7
  134. package/js/src/gate.js +124 -22
  135. package/js/src/gemini.d.ts +2 -2
  136. package/js/src/hitbtc.d.ts +3 -3
  137. package/js/src/hitbtc.js +4 -3
  138. package/js/src/hollaex.d.ts +2 -2
  139. package/js/src/htx.d.ts +3 -3
  140. package/js/src/htx.js +2 -0
  141. package/js/src/huobijp.d.ts +1 -1
  142. package/js/src/hyperliquid.d.ts +2 -2
  143. package/js/src/idex.d.ts +2 -2
  144. package/js/src/idex.js +3 -0
  145. package/js/src/independentreserve.js +3 -0
  146. package/js/src/indodax.d.ts +1 -1
  147. package/js/src/indodax.js +3 -0
  148. package/js/src/kraken.d.ts +1 -1
  149. package/js/src/kucoin.d.ts +2 -2
  150. package/js/src/kucoin.js +2 -0
  151. package/js/src/kucoinfutures.d.ts +1 -1
  152. package/js/src/kucoinfutures.js +2 -0
  153. package/js/src/kuna.d.ts +1 -1
  154. package/js/src/latoken.js +6 -0
  155. package/js/src/lbank.d.ts +1 -1
  156. package/js/src/luno.js +3 -0
  157. package/js/src/lykke.d.ts +1 -1
  158. package/js/src/lykke.js +5 -0
  159. package/js/src/mercado.d.ts +1 -1
  160. package/js/src/mercado.js +3 -0
  161. package/js/src/mexc.d.ts +5 -4
  162. package/js/src/mexc.js +111 -0
  163. package/js/src/ndax.d.ts +1 -1
  164. package/js/src/ndax.js +4 -0
  165. package/js/src/novadax.d.ts +1 -1
  166. package/js/src/novadax.js +4 -0
  167. package/js/src/okcoin.d.ts +2 -2
  168. package/js/src/okx.d.ts +10 -9
  169. package/js/src/okx.js +84 -1
  170. package/js/src/onetrading.d.ts +1 -1
  171. package/js/src/onetrading.js +3 -0
  172. package/js/src/p2b.js +3 -0
  173. package/js/src/paymium.d.ts +1 -1
  174. package/js/src/phemex.d.ts +1 -1
  175. package/js/src/poloniex.d.ts +1 -1
  176. package/js/src/pro/bybit.js +1 -1
  177. package/js/src/pro/coinbase.d.ts +2 -2
  178. package/js/src/pro/coinbase.js +30 -29
  179. package/js/src/pro/luno.d.ts +2 -2
  180. package/js/src/probit.d.ts +2 -2
  181. package/js/src/probit.js +3 -0
  182. package/js/src/timex.js +3 -0
  183. package/js/src/tokocrypto.d.ts +1 -1
  184. package/js/src/tradeogre.js +3 -0
  185. package/js/src/upbit.d.ts +2 -2
  186. package/js/src/wavesexchange.d.ts +1 -1
  187. package/js/src/wavesexchange.js +3 -0
  188. package/js/src/wazirx.js +3 -0
  189. package/js/src/whitebit.d.ts +2 -2
  190. package/js/src/woo.d.ts +1 -1
  191. package/js/src/woo.js +3 -1
  192. package/js/src/yobit.d.ts +1 -1
  193. package/js/src/yobit.js +3 -0
  194. package/js/src/zaif.d.ts +1 -1
  195. package/js/src/zonda.d.ts +2 -2
  196. package/package.json +1 -1
@@ -490,6 +490,8 @@ export default class Exchange {
490
490
  'fetchOrderWs': undefined,
491
491
  'fetchPermissions': undefined,
492
492
  'fetchPosition': undefined,
493
+ 'fetchPositionHistory': undefined,
494
+ 'fetchPositionsHistory': undefined,
493
495
  'fetchPositionWs': undefined,
494
496
  'fetchPositionMode': undefined,
495
497
  'fetchPositions': undefined,
@@ -6089,7 +6091,7 @@ export default class Exchange {
6089
6091
  parseLeverage(leverage, market = undefined) {
6090
6092
  throw new NotSupported(this.id + ' parseLeverage () is not supported yet');
6091
6093
  }
6092
- parseConversions(conversions, fromCurrencyKey = undefined, toCurrencyKey = undefined, since = undefined, limit = undefined, params = {}) {
6094
+ parseConversions(conversions, code = undefined, fromCurrencyKey = undefined, toCurrencyKey = undefined, since = undefined, limit = undefined, params = {}) {
6093
6095
  conversions = this.toArray(conversions);
6094
6096
  const result = [];
6095
6097
  let fromCurrency = undefined;
@@ -6108,8 +6110,18 @@ export default class Exchange {
6108
6110
  result.push(conversion);
6109
6111
  }
6110
6112
  const sorted = this.sortBy(result, 'timestamp');
6111
- const code = (fromCurrency !== undefined) ? fromCurrency['code'] : undefined;
6112
- return this.filterByCurrencySinceLimit(sorted, code, since, limit);
6113
+ let currency = undefined;
6114
+ if (code !== undefined) {
6115
+ currency = this.currency(code);
6116
+ code = currency['code'];
6117
+ }
6118
+ if (code === undefined) {
6119
+ return this.filterBySinceLimit(sorted, since, limit);
6120
+ }
6121
+ const fromConversion = this.filterBy(sorted, 'fromCurrency', code);
6122
+ const toConversion = this.filterBy(sorted, 'toCurrency', code);
6123
+ const both = this.arrayConcat(fromConversion, toConversion);
6124
+ return this.filterBySinceLimit(both, since, limit);
6113
6125
  }
6114
6126
  parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
6115
6127
  throw new NotSupported(this.id + ' parseConversion () is not supported yet');
@@ -6194,6 +6206,38 @@ export default class Exchange {
6194
6206
  const reconstructedDate = day + month + year;
6195
6207
  return reconstructedDate;
6196
6208
  }
6209
+ async fetchPositionHistory(symbol, since = undefined, limit = undefined, params = {}) {
6210
+ /**
6211
+ * @method
6212
+ * @name exchange#fetchPositionHistory
6213
+ * @description fetches the history of margin added or reduced from contract isolated positions
6214
+ * @param {string} [symbol] unified market symbol
6215
+ * @param {int} [since] timestamp in ms of the position
6216
+ * @param {int} [limit] the maximum amount of candles to fetch, default=1000
6217
+ * @param {object} params extra parameters specific to the exchange api endpoint
6218
+ * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
6219
+ */
6220
+ if (this.has['fetchPositionsHistory']) {
6221
+ const positions = await this.fetchPositionsHistory([symbol], since, limit, params);
6222
+ return this.safeDict(positions, 0);
6223
+ }
6224
+ else {
6225
+ throw new NotSupported(this.id + ' fetchPositionHistory () is not supported yet');
6226
+ }
6227
+ }
6228
+ async fetchPositionsHistory(symbols = undefined, since = undefined, limit = undefined, params = {}) {
6229
+ /**
6230
+ * @method
6231
+ * @name exchange#fetchPositionsHistory
6232
+ * @description fetches the history of margin added or reduced from contract isolated positions
6233
+ * @param {string} [symbol] unified market symbol
6234
+ * @param {int} [since] timestamp in ms of the position
6235
+ * @param {int} [limit] the maximum amount of candles to fetch, default=1000
6236
+ * @param {object} params extra parameters specific to the exchange api endpoint
6237
+ * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
6238
+ */
6239
+ throw new NotSupported(this.id + ' fetchPositionsHistory () is not supported yet');
6240
+ }
6197
6241
  parseMarginModification(data, market = undefined) {
6198
6242
  throw new NotSupported(this.id + ' parseMarginModification() is not supported yet');
6199
6243
  }
@@ -1,27 +1,28 @@
1
+ import { Dictionary, IndexType } from '../types.js';
1
2
  declare const keys: {
2
3
  (o: object): string[];
3
4
  (o: {}): string[];
4
5
  };
5
- declare const values: (x: any) => any[];
6
- declare const index: (x: any) => Set<any>;
6
+ declare const values: (x: any[] | Dictionary<any>) => any[];
7
+ declare const index: (x: any[]) => Set<any>;
7
8
  declare const extend: (...args: any[]) => any;
8
9
  declare const clone: (x: any) => any;
9
- declare const ordered: (x: any) => any;
10
- declare const unique: (x: any) => any[];
11
- declare const arrayConcat: (a: any, b: any) => any;
12
- declare const inArray: (needle: any, haystack: any) => any;
13
- declare const toArray: (object: any) => unknown[];
14
- declare const isEmpty: (object: any) => boolean;
15
- declare const keysort: (x: any, out?: {}) => {};
16
- declare const groupBy: (x: any, k: any, out?: {}) => {};
17
- declare const indexBy: (x: any, k: any, out?: {}) => {};
18
- declare const filterBy: (x: any, k: any, value?: any, out?: any[]) => any[];
19
- declare const sortBy: (array: any, key: any, descending?: boolean, defaultValue?: any, direction?: number) => any;
20
- declare const sortBy2: (array: any, key1: any, key2: any, descending?: boolean, direction?: number) => any;
21
- declare const flatten: (x: any, out?: any[]) => any[];
22
- declare const pluck: (x: any, k: any) => any[];
23
- declare const omit: (x: any, ...args: any[]) => any;
10
+ declare const ordered: (x: any[] | Dictionary<any>) => any[] | Dictionary<any>;
11
+ declare const unique: (x: any[]) => any[];
12
+ declare const arrayConcat: (a: any[], b: any[]) => any[];
13
+ declare const inArray: (needle: any, haystack: any[]) => boolean;
14
+ declare const toArray: (object: Dictionary<any> | any[]) => any[];
15
+ declare const isEmpty: (object: any[] | Dictionary<any>) => boolean;
16
+ declare const keysort: (x: Dictionary<any>, out?: Dictionary<any>) => Dictionary<any>;
17
+ declare const groupBy: (x: Dictionary<any>, k: string, out?: Dictionary<any>) => Dictionary<any>;
18
+ declare const indexBy: (x: Dictionary<any>, k: IndexType, out?: Dictionary<any>) => Dictionary<any>;
19
+ declare const filterBy: (x: Dictionary<any>, k: string, value?: any, out?: Dictionary<any>[]) => Dictionary<any>[];
20
+ declare const sortBy: (array: any[], key: IndexType, descending?: boolean, defaultValue?: any, direction?: number) => any[];
21
+ declare const sortBy2: (array: any[], key1: IndexType, key2: IndexType, descending?: boolean, direction?: number) => any[];
22
+ declare const flatten: (x: any[], out?: any[]) => any[];
23
+ declare const pluck: (x: Dictionary<any>, k: any) => any[];
24
+ declare const omit: (x: Dictionary<any>, ...args: any[]) => any;
24
25
  declare const sum: (...xs: any[]) => any;
25
- declare const deepExtend: (...xs: any[]) => any;
26
- declare const merge: (target: any, ...args: any[]) => any;
26
+ declare const deepExtend: (...xs: any) => any;
27
+ declare const merge: (target: Dictionary<any>, ...args: any) => Dictionary<any>;
27
28
  export { keys, values, extend, clone, index, ordered, unique, arrayConcat, inArray, toArray, isEmpty, keysort, indexBy, groupBy, filterBy, sortBy, sortBy2, flatten, pluck, omit, sum, deepExtend, merge, };
@@ -64,6 +64,6 @@ export default class bigone extends Exchange {
64
64
  status: string;
65
65
  };
66
66
  parseTransferStatus(status: any): string;
67
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
67
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
68
68
  handleErrors(httpCode: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
69
69
  }
@@ -135,7 +135,7 @@ export default class binance extends Exchange {
135
135
  }>;
136
136
  fetchDepositWithdrawFees(codes?: Strings, params?: {}): Promise<any>;
137
137
  parseDepositWithdrawFee(fee: any, currency?: Currency): any;
138
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
138
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
139
139
  parseTradingFee(fee: any, market?: Market): TradingFeeInterface;
140
140
  fetchTradingFee(symbol: string, params?: {}): Promise<TradingFeeInterface>;
141
141
  fetchTradingFees(params?: {}): Promise<TradingFees>;
@@ -301,8 +301,8 @@ export default class binance extends Exchange {
301
301
  request(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any, config?: {}): Promise<any>;
302
302
  modifyMarginHelper(symbol: string, amount: any, addOrReduce: any, params?: {}): Promise<any>;
303
303
  parseMarginModification(data: any, market?: Market): MarginModification;
304
- reduceMargin(symbol: string, amount: any, params?: {}): Promise<MarginModification>;
305
- addMargin(symbol: string, amount: any, params?: {}): Promise<MarginModification>;
304
+ reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
305
+ addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
306
306
  fetchCrossBorrowRate(code: string, params?: {}): Promise<{
307
307
  currency: string;
308
308
  rate: number;
package/js/src/binance.js CHANGED
@@ -128,8 +128,10 @@ export default class binance extends Exchange {
128
128
  'fetchOrders': true,
129
129
  'fetchOrderTrades': true,
130
130
  'fetchPosition': true,
131
+ 'fetchPositionHistory': false,
131
132
  'fetchPositionMode': true,
132
133
  'fetchPositions': true,
134
+ 'fetchPositionsHistory': false,
133
135
  'fetchPositionsRisk': true,
134
136
  'fetchPremiumIndexOHLCV': false,
135
137
  'fetchSettlementHistory': true,
@@ -12920,7 +12922,7 @@ export default class binance extends Exchange {
12920
12922
  //
12921
12923
  }
12922
12924
  const rows = this.safeList(response, responseQuery, []);
12923
- return this.parseConversions(rows, fromCurrencyKey, toCurrencyKey, since, limit);
12925
+ return this.parseConversions(rows, code, fromCurrencyKey, toCurrencyKey, since, limit);
12924
12926
  }
12925
12927
  parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
12926
12928
  //
package/js/src/bingx.d.ts CHANGED
@@ -97,7 +97,7 @@ export default class bingx extends Exchange {
97
97
  toAccount: string;
98
98
  status: string;
99
99
  };
100
- fetchDepositAddressesByNetwork(code: string, params?: {}): Promise<{}>;
100
+ fetchDepositAddressesByNetwork(code: string, params?: {}): Promise<import("./base/types.js").Dictionary<any>>;
101
101
  fetchDepositAddress(code: string, params?: {}): Promise<import("./base/types.js").Dictionary<any>>;
102
102
  parseDepositAddress(depositAddress: any, currency?: Currency): {
103
103
  currency: string;
@@ -132,8 +132,8 @@ export default class bingx extends Exchange {
132
132
  networks: {};
133
133
  };
134
134
  fetchDepositWithdrawFees(codes?: Strings, params?: {}): Promise<any>;
135
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
136
- parseParams(params: any): {};
135
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
136
+ parseParams(params: any): import("./base/types.js").Dictionary<any>;
137
137
  fetchMyLiquidations(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Liquidation[]>;
138
138
  parseLiquidation(liquidation: any, market?: Market): import("./base/types.js").Liquidation;
139
139
  closePosition(symbol: string, side?: OrderSide, params?: {}): Promise<Order>;
package/js/src/bingx.js CHANGED
@@ -75,8 +75,10 @@ export default class bingx extends Exchange {
75
75
  'fetchOrder': true,
76
76
  'fetchOrderBook': true,
77
77
  'fetchOrders': true,
78
+ 'fetchPositionHistory': false,
78
79
  'fetchPositionMode': true,
79
80
  'fetchPositions': true,
81
+ 'fetchPositionsHistory': false,
80
82
  'fetchTicker': true,
81
83
  'fetchTickers': true,
82
84
  'fetchTime': true,
@@ -2464,7 +2466,7 @@ export default class bingx extends Exchange {
2464
2466
  return this.safeOrder({
2465
2467
  'info': info,
2466
2468
  'id': this.safeString2(order, 'orderId', 'i'),
2467
- 'clientOrderId': this.safeStringN(order, ['clientOrderID', 'origClientOrderId', 'c']),
2469
+ 'clientOrderId': this.safeStringN(order, ['clientOrderID', 'clientOrderId', 'origClientOrderId', 'c']),
2468
2470
  'symbol': this.safeSymbol(marketId, market, '-', marketType),
2469
2471
  'timestamp': timestamp,
2470
2472
  'datetime': this.iso8601(timestamp),
@@ -32,7 +32,7 @@ export default class bitbank extends Exchange {
32
32
  network: any;
33
33
  info: any;
34
34
  }>;
35
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
35
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
36
36
  parseTransaction(transaction: any, currency?: Currency): Transaction;
37
37
  nonce(): number;
38
38
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
package/js/src/bitbank.js CHANGED
@@ -59,8 +59,11 @@ export default class bitbank extends Exchange {
59
59
  'fetchOrder': true,
60
60
  'fetchOrderBook': true,
61
61
  'fetchPosition': false,
62
+ 'fetchPositionHistory': false,
62
63
  'fetchPositionMode': false,
63
64
  'fetchPositions': false,
65
+ 'fetchPositionsForSymbol': false,
66
+ 'fetchPositionsHistory': false,
64
67
  'fetchPositionsRisk': false,
65
68
  'fetchPremiumIndexOHLCV': false,
66
69
  'fetchTicker': true,
@@ -74,7 +74,7 @@ export default class bitfinex extends Exchange {
74
74
  fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
75
75
  parseTransaction(transaction: any, currency?: Currency): Transaction;
76
76
  parseTransactionStatus(status: any): string;
77
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
77
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
78
78
  fetchPositions(symbols?: Strings, params?: {}): Promise<any>;
79
79
  nonce(): number;
80
80
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
@@ -78,7 +78,7 @@ export default class bitfinex2 extends Exchange {
78
78
  parseTransaction(transaction: any, currency?: Currency): Transaction;
79
79
  fetchTradingFees(params?: {}): Promise<TradingFees>;
80
80
  fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
81
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<any>;
81
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<any>;
82
82
  fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
83
83
  parsePosition(position: any, market?: Market): import("./base/types.js").Position;
84
84
  nonce(): number;
@@ -27,7 +27,7 @@ export default class bitflyer extends Exchange {
27
27
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
28
28
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
29
29
  fetchPositions(symbols?: Strings, params?: {}): Promise<any>;
30
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
30
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
31
31
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
32
32
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
33
33
  parseDepositStatus(status: any): string;
@@ -17,7 +17,7 @@ export default class bitget extends Exchange {
17
17
  fetchMarketLeverageTiers(symbol: string, params?: {}): Promise<any[]>;
18
18
  parseMarketLeverageTiers(info: any, market?: Market): any[];
19
19
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
20
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
20
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
21
21
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
22
22
  parseTransaction(transaction: any, currency?: Currency): Transaction;
23
23
  parseTransactionStatus(status: any): string;
@@ -145,8 +145,8 @@ export default class bitget extends Exchange {
145
145
  parseFundingHistories(contracts: any, market?: any, since?: Int, limit?: Int): FundingHistory[];
146
146
  modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<MarginModification>;
147
147
  parseMarginModification(data: any, market?: Market): MarginModification;
148
- reduceMargin(symbol: string, amount: any, params?: {}): Promise<MarginModification>;
149
- addMargin(symbol: string, amount: any, params?: {}): Promise<MarginModification>;
148
+ reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
149
+ addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
150
150
  fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
151
151
  parseLeverage(leverage: any, market?: any): Leverage;
152
152
  setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
@@ -282,6 +282,7 @@ export default class bitget extends Exchange {
282
282
  closeAllPositions(params?: {}): Promise<Position[]>;
283
283
  fetchMarginMode(symbol: string, params?: {}): Promise<MarginMode>;
284
284
  parseMarginMode(marginMode: any, market?: any): MarginMode;
285
+ fetchPositionsHistory(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
285
286
  fetchConvertQuote(fromCode: string, toCode: string, amount?: Num, params?: {}): Promise<Conversion>;
286
287
  createConvertTrade(id: string, fromCode: string, toCode: string, amount?: Num, params?: {}): Promise<Conversion>;
287
288
  fetchConvertTradeHistory(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Conversion[]>;
package/js/src/bitget.js CHANGED
@@ -109,8 +109,10 @@ export default class bitget extends Exchange {
109
109
  'fetchOrders': false,
110
110
  'fetchOrderTrades': false,
111
111
  'fetchPosition': true,
112
+ 'fetchPositionHistory': 'emulated',
112
113
  'fetchPositionMode': false,
113
114
  'fetchPositions': true,
115
+ 'fetchPositionsHistory': true,
114
116
  'fetchPositionsRisk': false,
115
117
  'fetchPremiumIndexOHLCV': false,
116
118
  'fetchStatus': false,
@@ -6551,7 +6553,7 @@ export default class bitget extends Exchange {
6551
6553
  // "cTime": "1700807507275"
6552
6554
  // }
6553
6555
  //
6554
- // fetchPositions: privateMixGetV2MixPositionHistoryPosition
6556
+ // fetchPositionsHistory: privateMixGetV2MixPositionHistoryPosition
6555
6557
  //
6556
6558
  // {
6557
6559
  // "symbol": "BTCUSDT",
@@ -8450,6 +8452,77 @@ export default class bitget extends Exchange {
8450
8452
  'marginMode': marginType,
8451
8453
  };
8452
8454
  }
8455
+ async fetchPositionsHistory(symbols = undefined, since = undefined, limit = undefined, params = {}) {
8456
+ /**
8457
+ * @method
8458
+ * @name bitget#fetchPositionsHistory
8459
+ * @description fetches historical positions
8460
+ * @see https://www.bitget.com/api-doc/contract/position/Get-History-Position
8461
+ * @param {string} [symbol] unified contract symbols
8462
+ * @param {int} [since] timestamp in ms of the earliest position to fetch, default=3 months ago, max range for params["until"] - since is 3 months
8463
+ * @param {int} [limit] the maximum amount of records to fetch, default=20, max=100
8464
+ * @param {object} params extra parameters specific to the exchange api endpoint
8465
+ * @param {int} [params.until] timestamp in ms of the latest position to fetch, max range for params["until"] - since is 3 months
8466
+ *
8467
+ * EXCHANGE SPECIFIC PARAMETERS
8468
+ * @param {string} [params.productType] USDT-FUTURES (default), COIN-FUTURES, USDC-FUTURES, SUSDT-FUTURES, SCOIN-FUTURES, or SUSDC-FUTURES
8469
+ * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
8470
+ */
8471
+ await this.loadMarkets();
8472
+ const until = this.safeInteger(params, 'until');
8473
+ params = this.omit(params, 'until');
8474
+ const request = {};
8475
+ if (symbols !== undefined) {
8476
+ const symbolsLength = symbols.length;
8477
+ if (symbolsLength > 0) {
8478
+ const market = this.market(symbols[0]);
8479
+ request['symbol'] = market['id'];
8480
+ }
8481
+ }
8482
+ if (since !== undefined) {
8483
+ request['startTime'] = since;
8484
+ }
8485
+ if (limit !== undefined) {
8486
+ request['limit'] = limit;
8487
+ }
8488
+ if (until !== undefined) {
8489
+ request['endTime'] = until;
8490
+ }
8491
+ const response = await this.privateMixGetV2MixPositionHistoryPosition(this.extend(request, params));
8492
+ //
8493
+ // {
8494
+ // code: '00000',
8495
+ // msg: 'success',
8496
+ // requestTime: '1712794148791',
8497
+ // data: {
8498
+ // list: [
8499
+ // {
8500
+ // symbol: 'XRPUSDT',
8501
+ // marginCoin: 'USDT',
8502
+ // holdSide: 'long',
8503
+ // openAvgPrice: '0.64967',
8504
+ // closeAvgPrice: '0.58799',
8505
+ // marginMode: 'isolated',
8506
+ // openTotalPos: '10',
8507
+ // closeTotalPos: '10',
8508
+ // pnl: '-0.62976205',
8509
+ // netProfit: '-0.65356802',
8510
+ // totalFunding: '-0.01638',
8511
+ // openFee: '-0.00389802',
8512
+ // closeFee: '-0.00352794',
8513
+ // ctime: '1709590322199',
8514
+ // utime: '1709667583395'
8515
+ // },
8516
+ // ...
8517
+ // ]
8518
+ // }
8519
+ // }
8520
+ //
8521
+ const data = this.safeDict(response, 'data');
8522
+ const responseList = this.safeList(data, 'list');
8523
+ const positions = this.parsePositions(responseList, symbols, params);
8524
+ return this.filterBySinceLimit(positions, since, limit);
8525
+ }
8453
8526
  async fetchConvertQuote(fromCode, toCode, amount = undefined, params = {}) {
8454
8527
  /**
8455
8528
  * @method
@@ -8602,7 +8675,7 @@ export default class bitget extends Exchange {
8602
8675
  //
8603
8676
  const data = this.safeDict(response, 'data', {});
8604
8677
  const dataList = this.safeList(data, 'dataList', []);
8605
- return this.parseConversions(dataList, 'fromCoin', 'toCoin', since, limit);
8678
+ return this.parseConversions(dataList, code, 'fromCoin', 'toCoin', since, limit);
8606
8679
  }
8607
8680
  parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
8608
8681
  //
@@ -26,7 +26,7 @@ export default class bithumb extends Exchange {
26
26
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
27
27
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
28
28
  cancelUnifiedOrder(order: any, params?: {}): Promise<any>;
29
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
29
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
30
30
  parseTransaction(transaction: any, currency?: Currency): Transaction;
31
31
  fixCommaNumber(numberStr: any): any;
32
32
  nonce(): number;
package/js/src/bithumb.js CHANGED
@@ -58,7 +58,11 @@ export default class bithumb extends Exchange {
58
58
  'fetchOrder': true,
59
59
  'fetchOrderBook': true,
60
60
  'fetchPosition': false,
61
+ 'fetchPositionHistory': false,
62
+ 'fetchPositionMode': false,
61
63
  'fetchPositions': false,
64
+ 'fetchPositionsForSymbol': false,
65
+ 'fetchPositionsHistory': false,
62
66
  'fetchPositionsRisk': false,
63
67
  'fetchPremiumIndexOHLCV': false,
64
68
  'fetchTicker': true,
@@ -80,7 +80,7 @@ export default class bitmart extends Exchange {
80
80
  network: any;
81
81
  };
82
82
  safeNetworkCode(networkId: any, currency?: any): string;
83
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<any>;
83
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<any>;
84
84
  fetchTransactionsByType(type: any, code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
85
85
  fetchDeposit(id: string, code?: Str, params?: {}): Promise<Transaction>;
86
86
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
@@ -67,7 +67,7 @@ export default class bitmex extends Exchange {
67
67
  parseLeverage(leverage: any, market?: any): Leverage;
68
68
  fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
69
69
  parsePosition(position: any, market?: Market): import("./base/types.js").Position;
70
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
70
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
71
71
  fetchFundingRates(symbols?: Strings, params?: {}): Promise<any>;
72
72
  parseFundingRate(contract: any, market?: Market): {
73
73
  info: any;
package/js/src/bitmex.js CHANGED
@@ -79,7 +79,9 @@ export default class bitmex extends Exchange {
79
79
  'fetchOrderBook': true,
80
80
  'fetchOrders': true,
81
81
  'fetchPosition': false,
82
+ 'fetchPositionHistory': false,
82
83
  'fetchPositions': true,
84
+ 'fetchPositionsHistory': false,
83
85
  'fetchPositionsRisk': false,
84
86
  'fetchPremiumIndexOHLCV': false,
85
87
  'fetchTicker': true,
@@ -37,7 +37,7 @@ export default class bitopro extends Exchange {
37
37
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
38
38
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
39
39
  fetchWithdrawal(id: string, code?: Str, params?: {}): Promise<Transaction>;
40
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
40
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
41
41
  parseDepositWithdrawFee(fee: any, currency?: Currency): {
42
42
  info: any;
43
43
  withdraw: {
package/js/src/bitopro.js CHANGED
@@ -68,8 +68,13 @@ export default class bitopro extends Exchange {
68
68
  'fetchOrderBook': true,
69
69
  'fetchOrders': false,
70
70
  'fetchOrderTrades': false,
71
+ 'fetchPosition': false,
72
+ 'fetchPositionHistory': false,
71
73
  'fetchPositionMode': false,
72
74
  'fetchPositions': false,
75
+ 'fetchPositionsForSymbol': false,
76
+ 'fetchPositionsHistory': false,
77
+ 'fetchPositionsRisk': false,
73
78
  'fetchPremiumIndexOHLCV': false,
74
79
  'fetchTicker': true,
75
80
  'fetchTickers': true,
@@ -45,7 +45,7 @@ export default class bitrue extends Exchange {
45
45
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
46
46
  parseTransactionStatusByType(status: any, type?: any): string;
47
47
  parseTransaction(transaction: any, currency?: Currency): Transaction;
48
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
48
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
49
49
  parseDepositWithdrawFee(fee: any, currency?: Currency): {
50
50
  info: any;
51
51
  withdraw: {
package/js/src/bitso.d.ts CHANGED
@@ -58,7 +58,7 @@ export default class bitso extends Exchange {
58
58
  fetchTransactionFees(codes?: string[], params?: {}): Promise<{}>;
59
59
  fetchDepositWithdrawFees(codes?: Strings, params?: {}): Promise<{}>;
60
60
  parseDepositWithdrawFees(response: any, codes?: any, currencyIdKey?: any): {};
61
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
61
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
62
62
  safeNetwork(networkId: any): string;
63
63
  parseTransaction(transaction: any, currency?: Currency): Transaction;
64
64
  parseTransactionStatus(status: any): string;
package/js/src/bitso.js CHANGED
@@ -72,8 +72,11 @@ export default class bitso extends Exchange {
72
72
  'fetchOrderBook': true,
73
73
  'fetchOrderTrades': true,
74
74
  'fetchPosition': false,
75
+ 'fetchPositionHistory': false,
75
76
  'fetchPositionMode': false,
76
77
  'fetchPositions': false,
78
+ 'fetchPositionsForSymbol': false,
79
+ 'fetchPositionsHistory': false,
77
80
  'fetchPositionsRisk': false,
78
81
  'fetchPremiumIndexOHLCV': false,
79
82
  'fetchTicker': true,
@@ -119,7 +119,7 @@ export default class bitstamp extends Exchange {
119
119
  network: any;
120
120
  info: any;
121
121
  }>;
122
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
122
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
123
123
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
124
124
  parseTransfer(transfer: any, currency?: any): {
125
125
  info: any;
@@ -72,8 +72,11 @@ export default class bitstamp extends Exchange {
72
72
  'fetchOrder': true,
73
73
  'fetchOrderBook': true,
74
74
  'fetchPosition': false,
75
+ 'fetchPositionHistory': false,
75
76
  'fetchPositionMode': false,
76
77
  'fetchPositions': false,
78
+ 'fetchPositionsForSymbol': false,
79
+ 'fetchPositionsHistory': false,
77
80
  'fetchPositionsRisk': false,
78
81
  'fetchPremiumIndexOHLCV': false,
79
82
  'fetchTicker': true,
package/js/src/bitteam.js CHANGED
@@ -90,7 +90,11 @@ export default class bitteam extends Exchange {
90
90
  'fetchOrders': true,
91
91
  'fetchOrderTrades': false,
92
92
  'fetchPosition': false,
93
+ 'fetchPositionHistory': false,
94
+ 'fetchPositionMode': false,
93
95
  'fetchPositions': false,
96
+ 'fetchPositionsForSymbol': false,
97
+ 'fetchPositionsHistory': false,
94
98
  'fetchPositionsRisk': false,
95
99
  'fetchPremiumIndexOHLCV': false,
96
100
  'fetchStatus': false,
@@ -50,7 +50,7 @@ export default class bitvavo extends Exchange {
50
50
  fetchMyTradesRequest(symbol?: Str, since?: Int, limit?: Int, params?: {}): any;
51
51
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
52
52
  withdrawRequest(code: Str, amount: any, address: any, tag?: any, params?: {}): any;
53
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
53
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
54
54
  fetchWithdrawalsRequest(code?: Str, since?: Int, limit?: Int, params?: {}): any;
55
55
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
56
56
  fetchDepositsRequest(code?: Str, since?: Int, limit?: Int, params?: {}): any;
package/js/src/bitvavo.js CHANGED
@@ -73,8 +73,11 @@ export default class bitvavo extends Exchange {
73
73
  'fetchOrderBook': true,
74
74
  'fetchOrders': true,
75
75
  'fetchPosition': false,
76
+ 'fetchPositionHistory': false,
76
77
  'fetchPositionMode': false,
77
78
  'fetchPositions': false,
79
+ 'fetchPositionsForSymbol': false,
80
+ 'fetchPositionsHistory': false,
78
81
  'fetchPositionsRisk': false,
79
82
  'fetchPremiumIndexOHLCV': false,
80
83
  'fetchTicker': true,
package/js/src/bl3p.js CHANGED
@@ -62,8 +62,11 @@ export default class bl3p extends Exchange {
62
62
  'fetchOpenInterestHistory': false,
63
63
  'fetchOrderBook': true,
64
64
  'fetchPosition': false,
65
+ 'fetchPositionHistory': false,
65
66
  'fetchPositionMode': false,
66
67
  'fetchPositions': false,
68
+ 'fetchPositionsForSymbol': false,
69
+ 'fetchPositionsHistory': false,
67
70
  'fetchPositionsRisk': false,
68
71
  'fetchPremiumIndexOHLCV': false,
69
72
  'fetchTicker': true,
@@ -36,7 +36,7 @@ export default class blockchaincom extends Exchange {
36
36
  }>;
37
37
  parseTransactionState(state: any): string;
38
38
  parseTransaction(transaction: any, currency?: Currency): Transaction;
39
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
39
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
40
40
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
41
41
  fetchWithdrawal(id: string, code?: Str, params?: {}): Promise<Transaction>;
42
42
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
@@ -70,8 +70,11 @@ export default class btcalpha extends Exchange {
70
70
  'fetchOrderBook': true,
71
71
  'fetchOrders': true,
72
72
  'fetchPosition': false,
73
+ 'fetchPositionHistory': false,
73
74
  'fetchPositionMode': false,
74
75
  'fetchPositions': false,
76
+ 'fetchPositionsForSymbol': false,
77
+ 'fetchPositionsHistory': false,
75
78
  'fetchPositionsRisk': false,
76
79
  'fetchPremiumIndexOHLCV': false,
77
80
  'fetchTicker': true,