ccxt 4.2.31 → 4.2.35

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 (302) hide show
  1. package/.gitattributes +1 -0
  2. package/CONTRIBUTING.md +20 -1
  3. package/README.md +8 -7
  4. package/build.sh +9 -2
  5. package/cleanup.sh +3 -0
  6. package/dist/ccxt.browser.js +741 -501
  7. package/dist/ccxt.browser.min.js +3 -3
  8. package/dist/cjs/ccxt.js +1 -1
  9. package/dist/cjs/src/ace.js +3 -2
  10. package/dist/cjs/src/ascendex.js +1 -1
  11. package/dist/cjs/src/base/Exchange.js +62 -20
  12. package/dist/cjs/src/bigone.js +21 -1
  13. package/dist/cjs/src/binance.js +59 -15
  14. package/dist/cjs/src/bingx.js +4 -3
  15. package/dist/cjs/src/bit2c.js +12 -0
  16. package/dist/cjs/src/bitfinex2.js +12 -1
  17. package/dist/cjs/src/bitget.js +3 -3
  18. package/dist/cjs/src/bitmart.js +1 -1
  19. package/dist/cjs/src/bitrue.js +3 -3
  20. package/dist/cjs/src/blockchaincom.js +1 -1
  21. package/dist/cjs/src/bybit.js +1 -1
  22. package/dist/cjs/src/coinbase.js +2 -2
  23. package/dist/cjs/src/coinex.js +1 -1
  24. package/dist/cjs/src/cryptocom.js +10 -10
  25. package/dist/cjs/src/gate.js +34 -29
  26. package/dist/cjs/src/kraken.js +39 -0
  27. package/dist/cjs/src/krakenfutures.js +25 -3
  28. package/dist/cjs/src/kucoin.js +1 -1
  29. package/dist/cjs/src/mexc.js +2 -1
  30. package/dist/cjs/src/okx.js +4 -3
  31. package/dist/cjs/src/phemex.js +8 -8
  32. package/dist/cjs/src/pro/alpaca.js +8 -4
  33. package/dist/cjs/src/pro/ascendex.js +1 -2
  34. package/dist/cjs/src/pro/binance.js +17 -13
  35. package/dist/cjs/src/pro/bingx.js +1 -1
  36. package/dist/cjs/src/pro/bitfinex.js +21 -24
  37. package/dist/cjs/src/pro/bitfinex2.js +13 -17
  38. package/dist/cjs/src/pro/bitget.js +3 -1
  39. package/dist/cjs/src/pro/bitmart.js +3 -8
  40. package/dist/cjs/src/pro/bitmex.js +4 -7
  41. package/dist/cjs/src/pro/bitopro.js +2 -5
  42. package/dist/cjs/src/pro/bitrue.js +1 -1
  43. package/dist/cjs/src/pro/bitstamp.js +2 -3
  44. package/dist/cjs/src/pro/bitvavo.js +12 -5
  45. package/dist/cjs/src/pro/blockchaincom.js +22 -23
  46. package/dist/cjs/src/pro/bybit.js +5 -5
  47. package/dist/cjs/src/pro/cex.js +7 -7
  48. package/dist/cjs/src/pro/coinbase.js +3 -2
  49. package/dist/cjs/src/pro/coinbasepro.js +1 -1
  50. package/dist/cjs/src/pro/coinex.js +15 -13
  51. package/dist/cjs/src/pro/currencycom.js +5 -7
  52. package/dist/cjs/src/pro/deribit.js +4 -4
  53. package/dist/cjs/src/pro/exmo.js +15 -13
  54. package/dist/cjs/src/pro/gate.js +1 -1
  55. package/dist/cjs/src/pro/gemini.js +4 -2
  56. package/dist/cjs/src/pro/hitbtc.js +9 -8
  57. package/dist/cjs/src/pro/hollaex.js +2 -2
  58. package/dist/cjs/src/pro/htx.js +6 -7
  59. package/dist/cjs/src/pro/huobijp.js +3 -5
  60. package/dist/cjs/src/pro/idex.js +1 -1
  61. package/dist/cjs/src/pro/independentreserve.js +14 -13
  62. package/dist/cjs/src/pro/kraken.js +10 -16
  63. package/dist/cjs/src/pro/krakenfutures.js +10 -6
  64. package/dist/cjs/src/pro/kucoin.js +10 -11
  65. package/dist/cjs/src/pro/kucoinfutures.js +12 -11
  66. package/dist/cjs/src/pro/lbank.js +10 -10
  67. package/dist/cjs/src/pro/luno.js +12 -14
  68. package/dist/cjs/src/pro/mexc.js +3 -2
  69. package/dist/cjs/src/pro/ndax.js +7 -13
  70. package/dist/cjs/src/pro/okcoin.js +7 -12
  71. package/dist/cjs/src/pro/okx.js +6 -11
  72. package/dist/cjs/src/pro/onetrading.js +16 -15
  73. package/dist/cjs/src/pro/p2b.js +5 -3
  74. package/dist/cjs/src/pro/phemex.js +16 -11
  75. package/dist/cjs/src/pro/poloniex.js +6 -4
  76. package/dist/cjs/src/pro/poloniexfutures.js +14 -9
  77. package/dist/cjs/src/pro/probit.js +15 -11
  78. package/dist/cjs/src/pro/upbit.js +8 -8
  79. package/dist/cjs/src/pro/wazirx.js +6 -3
  80. package/dist/cjs/src/pro/woo.js +8 -6
  81. package/dist/cjs/src/probit.js +3 -3
  82. package/dist/cjs/src/tokocrypto.js +2 -2
  83. package/dist/cjs/src/wavesexchange.js +2 -1
  84. package/dist/cjs/src/woo.js +1 -1
  85. package/dist/cjs/src/yobit.js +39 -0
  86. package/js/ccxt.d.ts +1 -1
  87. package/js/ccxt.js +1 -1
  88. package/js/src/ace.d.ts +1 -1
  89. package/js/src/ace.js +3 -2
  90. package/js/src/alpaca.d.ts +1 -1
  91. package/js/src/ascendex.d.ts +5 -15
  92. package/js/src/ascendex.js +1 -1
  93. package/js/src/base/Exchange.d.ts +86 -78
  94. package/js/src/base/Exchange.js +62 -20
  95. package/js/src/base/types.d.ts +90 -6
  96. package/js/src/bigone.d.ts +5 -15
  97. package/js/src/bigone.js +21 -1
  98. package/js/src/binance.d.ts +13 -23
  99. package/js/src/binance.js +59 -15
  100. package/js/src/bingx.d.ts +6 -16
  101. package/js/src/bingx.js +4 -3
  102. package/js/src/bit2c.d.ts +1 -1
  103. package/js/src/bit2c.js +12 -0
  104. package/js/src/bitbank.d.ts +2 -2
  105. package/js/src/bitbns.d.ts +1 -1
  106. package/js/src/bitfinex.d.ts +5 -5
  107. package/js/src/bitfinex2.d.ts +7 -17
  108. package/js/src/bitfinex2.js +12 -1
  109. package/js/src/bitflyer.d.ts +5 -5
  110. package/js/src/bitforex.d.ts +1 -1
  111. package/js/src/bitget.d.ts +8 -38
  112. package/js/src/bitget.js +3 -3
  113. package/js/src/bithumb.d.ts +2 -2
  114. package/js/src/bitmart.d.ts +10 -21
  115. package/js/src/bitmart.js +1 -1
  116. package/js/src/bitmex.d.ts +3 -3
  117. package/js/src/bitopro.d.ts +2 -2
  118. package/js/src/bitrue.d.ts +5 -15
  119. package/js/src/bitrue.js +3 -3
  120. package/js/src/bitso.d.ts +4 -4
  121. package/js/src/bitstamp.d.ts +2 -2
  122. package/js/src/bitteam.d.ts +1 -1
  123. package/js/src/bitvavo.d.ts +3 -3
  124. package/js/src/bl3p.d.ts +1 -1
  125. package/js/src/blockchaincom.d.ts +2 -2
  126. package/js/src/blockchaincom.js +1 -1
  127. package/js/src/btcalpha.d.ts +1 -1
  128. package/js/src/btcbox.d.ts +1 -1
  129. package/js/src/btcmarkets.d.ts +3 -3
  130. package/js/src/btcturk.d.ts +1 -1
  131. package/js/src/bybit.d.ts +8 -8
  132. package/js/src/bybit.js +1 -1
  133. package/js/src/cex.d.ts +1 -1
  134. package/js/src/coinbase.d.ts +6 -50
  135. package/js/src/coinbase.js +2 -2
  136. package/js/src/coinbasepro.d.ts +2 -2
  137. package/js/src/coincheck.d.ts +1 -1
  138. package/js/src/coinex.d.ts +8 -8
  139. package/js/src/coinex.js +1 -1
  140. package/js/src/coinlist.d.ts +4 -14
  141. package/js/src/coinmate.d.ts +2 -2
  142. package/js/src/coinmetro.d.ts +2 -2
  143. package/js/src/coinone.d.ts +1 -1
  144. package/js/src/coinsph.d.ts +2 -2
  145. package/js/src/coinspot.d.ts +1 -1
  146. package/js/src/cryptocom.d.ts +4 -4
  147. package/js/src/cryptocom.js +10 -10
  148. package/js/src/currencycom.d.ts +2 -2
  149. package/js/src/delta.d.ts +2 -2
  150. package/js/src/deribit.d.ts +4 -14
  151. package/js/src/digifinex.d.ts +10 -38
  152. package/js/src/exmo.d.ts +2 -2
  153. package/js/src/gate.d.ts +8 -18
  154. package/js/src/gate.js +34 -29
  155. package/js/src/gemini.d.ts +2 -2
  156. package/js/src/hitbtc.d.ts +6 -16
  157. package/js/src/hollaex.d.ts +2 -2
  158. package/js/src/htx.d.ts +11 -21
  159. package/js/src/huobijp.d.ts +4 -4
  160. package/js/src/idex.d.ts +3 -3
  161. package/js/src/independentreserve.d.ts +2 -2
  162. package/js/src/indodax.d.ts +2 -2
  163. package/js/src/kraken.d.ts +5 -5
  164. package/js/src/kraken.js +39 -0
  165. package/js/src/krakenfutures.d.ts +7 -7
  166. package/js/src/krakenfutures.js +25 -3
  167. package/js/src/kucoin.d.ts +8 -29
  168. package/js/src/kucoin.js +1 -1
  169. package/js/src/kucoinfutures.d.ts +4 -4
  170. package/js/src/kuna.d.ts +2 -2
  171. package/js/src/latoken.d.ts +4 -14
  172. package/js/src/lbank.d.ts +2 -5
  173. package/js/src/luno.d.ts +1 -1
  174. package/js/src/lykke.d.ts +2 -2
  175. package/js/src/mercado.d.ts +2 -2
  176. package/js/src/mexc.d.ts +6 -6
  177. package/js/src/mexc.js +2 -1
  178. package/js/src/ndax.d.ts +2 -2
  179. package/js/src/novadax.d.ts +4 -15
  180. package/js/src/oceanex.d.ts +1 -1
  181. package/js/src/okcoin.d.ts +5 -15
  182. package/js/src/okx.d.ts +8 -18
  183. package/js/src/okx.js +4 -3
  184. package/js/src/onetrading.d.ts +2 -2
  185. package/js/src/p2b.d.ts +1 -1
  186. package/js/src/paymium.d.ts +3 -13
  187. package/js/src/phemex.d.ts +5 -5
  188. package/js/src/phemex.js +8 -8
  189. package/js/src/poloniex.d.ts +4 -14
  190. package/js/src/poloniexfutures.d.ts +1 -1
  191. package/js/src/pro/alpaca.d.ts +2 -2
  192. package/js/src/pro/alpaca.js +8 -4
  193. package/js/src/pro/ascendex.d.ts +2 -2
  194. package/js/src/pro/ascendex.js +1 -2
  195. package/js/src/pro/binance.d.ts +3 -3
  196. package/js/src/pro/binance.js +17 -13
  197. package/js/src/pro/bingx.d.ts +1 -1
  198. package/js/src/pro/bingx.js +1 -1
  199. package/js/src/pro/bitfinex.d.ts +2 -2
  200. package/js/src/pro/bitfinex.js +21 -24
  201. package/js/src/pro/bitfinex2.d.ts +2 -2
  202. package/js/src/pro/bitfinex2.js +13 -17
  203. package/js/src/pro/bitget.js +3 -1
  204. package/js/src/pro/bitmart.d.ts +3 -3
  205. package/js/src/pro/bitmart.js +3 -8
  206. package/js/src/pro/bitmex.d.ts +1 -1
  207. package/js/src/pro/bitmex.js +4 -7
  208. package/js/src/pro/bitopro.d.ts +1 -1
  209. package/js/src/pro/bitopro.js +2 -5
  210. package/js/src/pro/bitrue.js +1 -1
  211. package/js/src/pro/bitstamp.d.ts +1 -1
  212. package/js/src/pro/bitstamp.js +2 -3
  213. package/js/src/pro/bitvavo.d.ts +3 -3
  214. package/js/src/pro/bitvavo.js +12 -5
  215. package/js/src/pro/blockchaincom.d.ts +8 -8
  216. package/js/src/pro/blockchaincom.js +22 -23
  217. package/js/src/pro/bybit.d.ts +2 -2
  218. package/js/src/pro/bybit.js +5 -5
  219. package/js/src/pro/cex.d.ts +1 -1
  220. package/js/src/pro/cex.js +7 -7
  221. package/js/src/pro/coinbase.d.ts +1 -1
  222. package/js/src/pro/coinbase.js +3 -2
  223. package/js/src/pro/coinbasepro.d.ts +1 -1
  224. package/js/src/pro/coinbasepro.js +1 -1
  225. package/js/src/pro/coinex.d.ts +2 -2
  226. package/js/src/pro/coinex.js +15 -13
  227. package/js/src/pro/currencycom.d.ts +1 -1
  228. package/js/src/pro/currencycom.js +5 -7
  229. package/js/src/pro/deribit.d.ts +2 -2
  230. package/js/src/pro/deribit.js +4 -4
  231. package/js/src/pro/exmo.d.ts +2 -2
  232. package/js/src/pro/exmo.js +15 -13
  233. package/js/src/pro/gate.js +1 -1
  234. package/js/src/pro/gemini.d.ts +1 -1
  235. package/js/src/pro/gemini.js +4 -2
  236. package/js/src/pro/hitbtc.d.ts +2 -2
  237. package/js/src/pro/hitbtc.js +9 -8
  238. package/js/src/pro/hollaex.d.ts +2 -2
  239. package/js/src/pro/hollaex.js +2 -2
  240. package/js/src/pro/htx.d.ts +2 -2
  241. package/js/src/pro/htx.js +6 -7
  242. package/js/src/pro/huobijp.d.ts +1 -1
  243. package/js/src/pro/huobijp.js +3 -5
  244. package/js/src/pro/idex.js +1 -1
  245. package/js/src/pro/independentreserve.d.ts +1 -1
  246. package/js/src/pro/independentreserve.js +14 -13
  247. package/js/src/pro/kraken.d.ts +2 -2
  248. package/js/src/pro/kraken.js +10 -16
  249. package/js/src/pro/krakenfutures.d.ts +1 -1
  250. package/js/src/pro/krakenfutures.js +10 -6
  251. package/js/src/pro/kucoin.d.ts +3 -3
  252. package/js/src/pro/kucoin.js +10 -11
  253. package/js/src/pro/kucoinfutures.d.ts +3 -3
  254. package/js/src/pro/kucoinfutures.js +12 -11
  255. package/js/src/pro/lbank.d.ts +1 -1
  256. package/js/src/pro/lbank.js +10 -10
  257. package/js/src/pro/luno.d.ts +2 -2
  258. package/js/src/pro/luno.js +12 -14
  259. package/js/src/pro/mexc.d.ts +2 -2
  260. package/js/src/pro/mexc.js +3 -2
  261. package/js/src/pro/ndax.d.ts +3 -3
  262. package/js/src/pro/ndax.js +7 -13
  263. package/js/src/pro/okcoin.d.ts +1 -1
  264. package/js/src/pro/okcoin.js +7 -12
  265. package/js/src/pro/okx.d.ts +1 -1
  266. package/js/src/pro/okx.js +6 -11
  267. package/js/src/pro/onetrading.d.ts +1 -1
  268. package/js/src/pro/onetrading.js +16 -15
  269. package/js/src/pro/p2b.d.ts +1 -1
  270. package/js/src/pro/p2b.js +5 -3
  271. package/js/src/pro/phemex.d.ts +3 -3
  272. package/js/src/pro/phemex.js +16 -11
  273. package/js/src/pro/poloniex.d.ts +1 -1
  274. package/js/src/pro/poloniex.js +6 -4
  275. package/js/src/pro/poloniexfutures.d.ts +4 -4
  276. package/js/src/pro/poloniexfutures.js +13 -10
  277. package/js/src/pro/probit.d.ts +1 -1
  278. package/js/src/pro/probit.js +14 -12
  279. package/js/src/pro/upbit.js +8 -8
  280. package/js/src/pro/wazirx.d.ts +1 -1
  281. package/js/src/pro/wazirx.js +6 -3
  282. package/js/src/pro/woo.d.ts +3 -3
  283. package/js/src/pro/woo.js +8 -6
  284. package/js/src/probit.d.ts +3 -3
  285. package/js/src/probit.js +3 -3
  286. package/js/src/timex.d.ts +1 -1
  287. package/js/src/tokocrypto.d.ts +3 -3
  288. package/js/src/tokocrypto.js +2 -2
  289. package/js/src/upbit.d.ts +2 -2
  290. package/js/src/wavesexchange.d.ts +3 -4
  291. package/js/src/wavesexchange.js +2 -1
  292. package/js/src/wazirx.d.ts +1 -1
  293. package/js/src/whitebit.d.ts +5 -15
  294. package/js/src/woo.d.ts +5 -15
  295. package/js/src/woo.js +1 -1
  296. package/js/src/yobit.d.ts +21 -6
  297. package/js/src/yobit.js +39 -0
  298. package/js/src/zaif.d.ts +2 -2
  299. package/js/src/zonda.d.ts +4 -14
  300. package/package.json +22 -8
  301. package/skip-tests.json +9 -1
  302. package/tests-manager.sh +1 -2
@@ -203,34 +203,118 @@ export interface DepositAddressResponse {
203
203
  info: any;
204
204
  tag?: string;
205
205
  }
206
+ export interface FundingRate {
207
+ symbol: string;
208
+ info: any;
209
+ timestamp?: number;
210
+ fundingRate?: number;
211
+ datetime?: string;
212
+ markPrice?: number;
213
+ indexPrice?: number;
214
+ interestRate?: number;
215
+ estimatedSettlePrice?: number;
216
+ fundingTimestamp?: number;
217
+ fundingDatetime?: string;
218
+ nextFundingTimestamp?: number;
219
+ nextFundingDatetime?: string;
220
+ nextFundingRate?: number;
221
+ previousFundingTimestamp?: number;
222
+ previousFundingDatetime?: string;
223
+ previousFundingRate?: number;
224
+ }
206
225
  export interface Position {
207
226
  symbol: string;
208
- id: string;
227
+ id?: string;
228
+ info: any;
209
229
  timestamp?: number;
210
- datetime: string;
230
+ datetime?: string;
211
231
  contracts?: number;
212
232
  contractSize?: number;
213
233
  side: string;
214
234
  notional?: number;
215
235
  leverage?: number;
216
236
  unrealizedPnl?: number;
217
- realizedPnl?: number;
218
237
  collateral?: number;
219
238
  entryPrice?: number;
220
239
  markPrice?: number;
221
240
  liquidationPrice?: number;
241
+ marginMode?: string;
222
242
  hedged?: boolean;
223
- maintenanceMargin?: number;
243
+ maintenenceMargin?: number;
224
244
  maintenanceMarginPercentage?: number;
225
245
  initialMargin?: number;
226
246
  initialMarginPercentage?: number;
227
- marginMode: string;
228
247
  marginRatio?: number;
229
248
  lastUpdateTimestamp?: number;
230
249
  lastPrice?: number;
231
- percentage?: number;
232
250
  stopLossPrice?: number;
233
251
  takeProfitPrice?: number;
252
+ percentage?: number;
253
+ }
254
+ export interface BorrowInterest {
255
+ account?: string;
256
+ currency?: string;
257
+ interest?: number;
258
+ interestRate?: number;
259
+ amountBorrowed?: number;
260
+ marginMode?: string;
261
+ timestamp?: number;
262
+ datetime?: string;
263
+ info: any;
264
+ }
265
+ export interface LeverageTier {
266
+ tier?: number;
267
+ currency?: string;
268
+ minNotional?: number;
269
+ maxNotional?: number;
270
+ maintenanceMarginRate?: number;
271
+ maxLeverage?: number;
272
+ info: any;
273
+ }
274
+ export interface LedgerEntry {
275
+ id?: string;
276
+ info: any;
277
+ timestamp?: number;
278
+ datetime?: string;
279
+ direction?: string;
280
+ account?: string;
281
+ referenceId?: string;
282
+ referenceAccount?: string;
283
+ type?: string;
284
+ currency?: string;
285
+ amount?: number;
286
+ before?: number;
287
+ after?: number;
288
+ status?: string;
289
+ fee?: Fee;
290
+ }
291
+ export interface DepositWithdrawFeeNetwork {
292
+ fee?: number;
293
+ percentage?: boolean;
294
+ }
295
+ export interface DepositWithdrawFee {
296
+ info: any;
297
+ withdraw?: DepositWithdrawFeeNetwork;
298
+ deposit?: DepositWithdrawFeeNetwork;
299
+ networks?: Dictionary<DepositWithdrawFeeNetwork>;
300
+ }
301
+ export interface TransferEntry {
302
+ info?: any;
303
+ id?: string;
304
+ timestamp?: number;
305
+ datetime?: string;
306
+ currency?: string;
307
+ amount?: number;
308
+ fromAccount?: string;
309
+ toAccount?: string;
310
+ status?: string;
311
+ }
312
+ export interface BorrowRate {
313
+ currency?: string;
314
+ rate?: number;
315
+ period?: number;
316
+ timestamp?: number;
317
+ datetime?: string;
234
318
  info: any;
235
319
  }
236
320
  export interface FundingRateHistory {
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bigone.js';
2
- import type { Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction } from './base/types.js';
2
+ import type { TransferEntry, Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction } from './base/types.js';
3
3
  /**
4
4
  * @class bigone
5
5
  * @augments Exchange
@@ -24,7 +24,7 @@ export default class bigone extends Exchange {
24
24
  parseType(type: string): string;
25
25
  parseOrder(order: any, market?: Market): Order;
26
26
  createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
27
- createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
27
+ createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
28
28
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
29
29
  cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
30
30
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
@@ -51,29 +51,19 @@ export default class bigone extends Exchange {
51
51
  parseTransaction(transaction: any, currency?: Currency): Transaction;
52
52
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
53
53
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
54
- transfer(code: string, amount: any, fromAccount: any, toAccount: any, params?: {}): Promise<{
55
- info: any;
56
- id: any;
57
- timestamp: any;
58
- datetime: any;
59
- currency: number;
60
- amount: any;
61
- fromAccount: any;
62
- toAccount: any;
63
- status: string;
64
- }>;
54
+ transfer(code: string, amount: number, fromAccount: any, toAccount: any, params?: {}): Promise<TransferEntry>;
65
55
  parseTransfer(transfer: any, currency?: Currency): {
66
56
  info: any;
67
57
  id: any;
68
58
  timestamp: any;
69
59
  datetime: any;
70
- currency: number;
60
+ currency: any;
71
61
  amount: any;
72
62
  fromAccount: any;
73
63
  toAccount: any;
74
64
  status: string;
75
65
  };
76
66
  parseTransferStatus(status: any): string;
77
- withdraw(code: string, amount: any, address: any, tag?: any, params?: {}): Promise<Transaction>;
67
+ withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
78
68
  handleErrors(httpCode: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
79
69
  }
package/js/src/bigone.js CHANGED
@@ -521,6 +521,7 @@ export default class bigone extends Exchange {
521
521
  * @method
522
522
  * @name bigone#fetchMarkets
523
523
  * @description retrieves data on all markets for bigone
524
+ * @see https://open.big.one/docs/spot_asset_pair.html
524
525
  * @param {object} [params] extra parameters specific to the exchange API endpoint
525
526
  * @returns {object[]} an array of objects representing market data
526
527
  */
@@ -783,6 +784,7 @@ export default class bigone extends Exchange {
783
784
  * @method
784
785
  * @name bigone#fetchTicker
785
786
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
787
+ * @see https://open.big.one/docs/spot_tickers.html
786
788
  * @param {string} symbol unified symbol of the market to fetch the ticker for
787
789
  * @param {object} [params] extra parameters specific to the exchange API endpoint
788
790
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -825,6 +827,7 @@ export default class bigone extends Exchange {
825
827
  * @method
826
828
  * @name bigone#fetchTickers
827
829
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
830
+ * @see https://open.big.one/docs/spot_tickers.html
828
831
  * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
829
832
  * @param {object} [params] extra parameters specific to the exchange API endpoint
830
833
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -912,6 +915,7 @@ export default class bigone extends Exchange {
912
915
  * @method
913
916
  * @name bigone#fetchTime
914
917
  * @description fetches the current integer timestamp in milliseconds from the exchange server
918
+ * @see https://open.big.one/docs/spot_ping.html
915
919
  * @param {object} [params] extra parameters specific to the exchange API endpoint
916
920
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
917
921
  */
@@ -932,6 +936,7 @@ export default class bigone extends Exchange {
932
936
  * @method
933
937
  * @name bigone#fetchOrderBook
934
938
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
939
+ * @see https://open.big.one/docs/contract_misc.html#get-orderbook-snapshot
935
940
  * @param {string} symbol unified symbol of the market to fetch the order book for
936
941
  * @param {int} [limit] the maximum amount of order book entries to return
937
942
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1174,6 +1179,7 @@ export default class bigone extends Exchange {
1174
1179
  * @method
1175
1180
  * @name bigone#fetchTrades
1176
1181
  * @description get the list of most recent trades for a particular symbol
1182
+ * @see https://open.big.one/docs/spot_asset_pair_trade.html
1177
1183
  * @param {string} symbol unified symbol of the market to fetch trades for
1178
1184
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
1179
1185
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -1238,6 +1244,7 @@ export default class bigone extends Exchange {
1238
1244
  * @method
1239
1245
  * @name bigone#fetchOHLCV
1240
1246
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1247
+ * @see https://open.big.one/docs/spot_asset_pair_candle.html
1241
1248
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1242
1249
  * @param {string} timeframe the length of time each candle represents
1243
1250
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -1314,6 +1321,8 @@ export default class bigone extends Exchange {
1314
1321
  * @method
1315
1322
  * @name bigone#fetchBalance
1316
1323
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
1324
+ * @see https://open.big.one/docs/fund_accounts.html
1325
+ * @see https://open.big.one/docs/spot_accounts.html
1317
1326
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1318
1327
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1319
1328
  */
@@ -1559,6 +1568,7 @@ export default class bigone extends Exchange {
1559
1568
  * @method
1560
1569
  * @name bigone#cancelOrder
1561
1570
  * @description cancels an open order
1571
+ * @see https://open.big.one/docs/spot_orders.html#cancel-order
1562
1572
  * @param {string} id order id
1563
1573
  * @param {string} symbol Not used by bigone cancelOrder ()
1564
1574
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1587,6 +1597,7 @@ export default class bigone extends Exchange {
1587
1597
  * @method
1588
1598
  * @name bigone#cancelAllOrders
1589
1599
  * @description cancel all open orders
1600
+ * @see https://open.big.one/docs/spot_orders.html#cancel-all-orders
1590
1601
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
1591
1602
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1592
1603
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -1616,6 +1627,7 @@ export default class bigone extends Exchange {
1616
1627
  * @method
1617
1628
  * @name bigone#fetchOrder
1618
1629
  * @description fetches information on an order made by the user
1630
+ * @see https://open.big.one/docs/spot_orders.html#get-one-order
1619
1631
  * @param {string} symbol not used by bigone fetchOrder
1620
1632
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1621
1633
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -1631,6 +1643,7 @@ export default class bigone extends Exchange {
1631
1643
  * @method
1632
1644
  * @name bigone#fetchOrders
1633
1645
  * @description fetches information on multiple orders made by the user
1646
+ * @see https://open.big.one/docs/spot_orders.html#get-user-orders-in-one-asset-pair
1634
1647
  * @param {string} symbol unified market symbol of the market orders were made in
1635
1648
  * @param {int} [since] the earliest time in ms to fetch orders for
1636
1649
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -1681,6 +1694,7 @@ export default class bigone extends Exchange {
1681
1694
  * @method
1682
1695
  * @name bigone#fetchMyTrades
1683
1696
  * @description fetch all trades made by the user
1697
+ * @see https://open.big.one/docs/spot_trade.html#trades-of-user
1684
1698
  * @param {string} symbol unified market symbol
1685
1699
  * @param {int} [since] the earliest time in ms to fetch trades for
1686
1700
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -1750,6 +1764,7 @@ export default class bigone extends Exchange {
1750
1764
  * @method
1751
1765
  * @name bigone#fetchOpenOrders
1752
1766
  * @description fetch all unfilled currently open orders
1767
+ * @see https://open.big.one/docs/spot_orders.html#get-user-orders-in-one-asset-pair
1753
1768
  * @param {string} symbol unified market symbol
1754
1769
  * @param {int} [since] the earliest time in ms to fetch open orders for
1755
1770
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -1766,6 +1781,7 @@ export default class bigone extends Exchange {
1766
1781
  * @method
1767
1782
  * @name bigone#fetchClosedOrders
1768
1783
  * @description fetches information on multiple closed orders made by the user
1784
+ * @see https://open.big.one/docs/spot_orders.html#get-user-orders-in-one-asset-pair
1769
1785
  * @param {string} symbol unified market symbol of the market orders were made in
1770
1786
  * @param {int} [since] the earliest time in ms to fetch orders for
1771
1787
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -1820,6 +1836,7 @@ export default class bigone extends Exchange {
1820
1836
  * @method
1821
1837
  * @name bigone#fetchDepositAddress
1822
1838
  * @description fetch the deposit address for a currency associated with this account
1839
+ * @see https://open.big.one/docs/spot_deposit.html#get-deposite-address-of-one-asset-of-user
1823
1840
  * @param {string} code unified currency code
1824
1841
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1825
1842
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -1970,6 +1987,7 @@ export default class bigone extends Exchange {
1970
1987
  * @method
1971
1988
  * @name bigone#fetchDeposits
1972
1989
  * @description fetch all deposits made to an account
1990
+ * @see https://open.big.one/docs/spot_deposit.html#deposit-of-user
1973
1991
  * @param {string} code unified currency code
1974
1992
  * @param {int} [since] the earliest time in ms to fetch deposits for
1975
1993
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -2021,6 +2039,7 @@ export default class bigone extends Exchange {
2021
2039
  * @method
2022
2040
  * @name bigone#fetchWithdrawals
2023
2041
  * @description fetch all withdrawals made from an account
2042
+ * @see https://open.big.one/docs/spot_withdrawal.html#get-withdrawals-of-user
2024
2043
  * @param {string} code unified currency code
2025
2044
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
2026
2045
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -2126,7 +2145,7 @@ export default class bigone extends Exchange {
2126
2145
  'id': undefined,
2127
2146
  'timestamp': undefined,
2128
2147
  'datetime': undefined,
2129
- 'currency': code,
2148
+ 'currency': undefined,
2130
2149
  'amount': undefined,
2131
2150
  'fromAccount': undefined,
2132
2151
  'toAccount': undefined,
@@ -2144,6 +2163,7 @@ export default class bigone extends Exchange {
2144
2163
  * @method
2145
2164
  * @name bigone#withdraw
2146
2165
  * @description make a withdrawal
2166
+ * @see https://open.big.one/docs/spot_withdrawal.html#create-withdrawal-of-user
2147
2167
  * @param {string} code unified currency code
2148
2168
  * @param {float} amount the amount to withdraw
2149
2169
  * @param {string} address the address to withdraw to
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/binance.js';
2
- import type { Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, Str, Transaction, Ticker, OrderBook, Tickers, Market, Greeks, Strings, Currency, MarketInterface } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, Str, Transaction, Ticker, OrderBook, Tickers, Market, Greeks, Strings, Currency, MarketInterface } from './base/types.js';
3
3
  /**
4
4
  * @class binance
5
5
  * @augments Exchange
@@ -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
- parseBalance(response: any, type?: any, marginMode?: any): Balances;
24
+ parseBalanceCustom(response: any, type?: any, marginMode?: any): 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;
@@ -48,15 +48,15 @@ export default class binance extends Exchange {
48
48
  fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
49
49
  parseTrade(trade: any, market?: Market): Trade;
50
50
  fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
51
- editSpotOrder(id: string, symbol: any, type: any, side: any, amount: any, price?: any, params?: {}): Promise<Order>;
52
- editSpotOrderRequest(id: string, symbol: any, type: any, side: any, amount: any, price?: any, params?: {}): any;
53
- editContractOrder(id: string, symbol: any, type: any, side: any, amount: any, price?: any, params?: {}): Promise<Order>;
51
+ editSpotOrder(id: string, symbol: any, type: any, side: any, amount: number, price?: number, params?: {}): Promise<Order>;
52
+ editSpotOrderRequest(id: string, symbol: any, type: any, side: any, amount: number, price?: number, params?: {}): any;
53
+ editContractOrder(id: string, symbol: any, type: any, side: any, amount: number, price?: number, params?: {}): Promise<Order>;
54
54
  editOrder(id: string, symbol: any, type: any, side: any, amount?: any, price?: any, params?: {}): Promise<Order>;
55
55
  parseOrderStatus(status: any): string;
56
56
  parseOrder(order: any, market?: Market): Order;
57
57
  createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
58
- createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
59
- createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): any;
58
+ createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
59
+ createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): any;
60
60
  createMarketOrderWithCost(symbol: string, side: OrderSide, cost: any, params?: {}): Promise<Order>;
61
61
  createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
62
62
  createMarketSellOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
@@ -114,17 +114,7 @@ export default class binance extends Exchange {
114
114
  id: string;
115
115
  amount: number;
116
116
  };
117
- transfer(code: string, amount: any, fromAccount: any, toAccount: any, params?: {}): Promise<{
118
- info: any;
119
- id: string;
120
- timestamp: number;
121
- datetime: string;
122
- currency: string;
123
- amount: number;
124
- fromAccount: any;
125
- toAccount: any;
126
- status: string;
127
- }>;
117
+ transfer(code: string, amount: number, fromAccount: any, toAccount: any, params?: {}): Promise<TransferEntry>;
128
118
  fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
129
119
  fetchDepositAddress(code: string, params?: {}): Promise<{
130
120
  currency: string;
@@ -140,7 +130,7 @@ export default class binance extends Exchange {
140
130
  }>;
141
131
  fetchDepositWithdrawFees(codes?: Strings, params?: {}): Promise<any>;
142
132
  parseDepositWithdrawFee(fee: any, currency?: Currency): any;
143
- withdraw(code: string, amount: any, address: any, tag?: any, params?: {}): Promise<Transaction>;
133
+ withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
144
134
  parseTradingFee(fee: any, market?: Market): {
145
135
  info: any;
146
136
  symbol: string;
@@ -269,7 +259,7 @@ export default class binance extends Exchange {
269
259
  fetchAccountPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
270
260
  fetchPositionsRisk(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
271
261
  fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").FundingHistory[]>;
272
- setLeverage(leverage: any, symbol?: Str, params?: {}): Promise<any>;
262
+ setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
273
263
  setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
274
264
  setPositionMode(hedged: any, symbol?: Str, params?: {}): Promise<any>;
275
265
  fetchSettlementHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
@@ -310,7 +300,7 @@ export default class binance extends Exchange {
310
300
  getExceptionsByUrl(url: any, exactOrBroad: any): any;
311
301
  handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
312
302
  calculateRateLimiterCost(api: any, method: any, path: any, params: any, config?: {}): any;
313
- request(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any, config?: {}, context?: {}): Promise<any>;
303
+ request(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any, config?: {}): Promise<any>;
314
304
  modifyMarginHelper(symbol: string, amount: any, addOrReduce: any, params?: {}): Promise<any>;
315
305
  parseMarginModification(data: any, market?: Market): {
316
306
  info: any;
@@ -380,7 +370,7 @@ export default class binance extends Exchange {
380
370
  datetime: any;
381
371
  info: any;
382
372
  }>;
383
- borrowCrossMargin(code: string, amount: any, params?: {}): Promise<{
373
+ borrowCrossMargin(code: string, amount: number, params?: {}): Promise<{
384
374
  id: number;
385
375
  currency: string;
386
376
  amount: any;
@@ -389,7 +379,7 @@ export default class binance extends Exchange {
389
379
  datetime: any;
390
380
  info: any;
391
381
  }>;
392
- borrowIsolatedMargin(symbol: string, code: string, amount: any, params?: {}): Promise<{
382
+ borrowIsolatedMargin(symbol: string, code: string, amount: number, params?: {}): Promise<{
393
383
  id: number;
394
384
  currency: string;
395
385
  amount: any;
package/js/src/binance.js CHANGED
@@ -3139,16 +3139,31 @@ export default class binance extends Exchange {
3139
3139
  account['debt'] = Precise.stringAdd(debt, interest);
3140
3140
  return account;
3141
3141
  }
3142
- parseBalance(response, type = undefined, marginMode = undefined) {
3142
+ parseBalanceCustom(response, type = undefined, marginMode = undefined) {
3143
3143
  const result = {
3144
3144
  'info': response,
3145
3145
  };
3146
3146
  let timestamp = undefined;
3147
3147
  const isolated = marginMode === 'isolated';
3148
3148
  const cross = (type === 'margin') || (marginMode === 'cross');
3149
- if (!isolated && ((type === 'spot') || cross)) {
3149
+ if (type === 'papi') {
3150
+ for (let i = 0; i < response.length; i++) {
3151
+ const entry = response[i];
3152
+ const account = this.account();
3153
+ const currencyId = this.safeString(entry, 'asset');
3154
+ const code = this.safeCurrencyCode(currencyId);
3155
+ const borrowed = this.safeString(entry, 'crossMarginBorrowed');
3156
+ const interest = this.safeString(entry, 'crossMarginInterest');
3157
+ account['free'] = this.safeString(entry, 'crossMarginFree');
3158
+ account['used'] = this.safeString(entry, 'crossMarginLocked');
3159
+ account['total'] = this.safeString(entry, 'crossMarginAsset');
3160
+ account['debt'] = Precise.stringAdd(borrowed, interest);
3161
+ result[code] = account;
3162
+ }
3163
+ }
3164
+ else if (!isolated && ((type === 'spot') || cross)) {
3150
3165
  timestamp = this.safeInteger(response, 'updateTime');
3151
- const balances = this.safeValue2(response, 'balances', 'userAssets', []);
3166
+ const balances = this.safeList2(response, 'balances', 'userAssets', []);
3152
3167
  for (let i = 0; i < balances.length; i++) {
3153
3168
  const balance = balances[i];
3154
3169
  const currencyId = this.safeString(balance, 'asset');
@@ -3165,13 +3180,13 @@ export default class binance extends Exchange {
3165
3180
  }
3166
3181
  }
3167
3182
  else if (isolated) {
3168
- const assets = this.safeValue(response, 'assets');
3183
+ const assets = this.safeList(response, 'assets');
3169
3184
  for (let i = 0; i < assets.length; i++) {
3170
3185
  const asset = assets[i];
3171
- const marketId = this.safeValue(asset, 'symbol');
3186
+ const marketId = this.safeString(asset, 'symbol');
3172
3187
  const symbol = this.safeSymbol(marketId, undefined, undefined, 'spot');
3173
- const base = this.safeValue(asset, 'baseAsset', {});
3174
- const quote = this.safeValue(asset, 'quoteAsset', {});
3188
+ const base = this.safeDict(asset, 'baseAsset', {});
3189
+ const quote = this.safeDict(asset, 'quoteAsset', {});
3175
3190
  const baseCode = this.safeCurrencyCode(this.safeString(base, 'asset'));
3176
3191
  const quoteCode = this.safeCurrencyCode(this.safeString(quote, 'asset'));
3177
3192
  const subResult = {};
@@ -3181,7 +3196,7 @@ export default class binance extends Exchange {
3181
3196
  }
3182
3197
  }
3183
3198
  else if (type === 'savings') {
3184
- const positionAmountVos = this.safeValue(response, 'positionAmountVos', []);
3199
+ const positionAmountVos = this.safeList(response, 'positionAmountVos', []);
3185
3200
  for (let i = 0; i < positionAmountVos.length; i++) {
3186
3201
  const entry = positionAmountVos[i];
3187
3202
  const currencyId = this.safeString(entry, 'asset');
@@ -3210,7 +3225,7 @@ export default class binance extends Exchange {
3210
3225
  else {
3211
3226
  let balances = response;
3212
3227
  if (!Array.isArray(response)) {
3213
- balances = this.safeValue(response, 'assets', []);
3228
+ balances = this.safeList(response, 'assets', []);
3214
3229
  }
3215
3230
  for (let i = 0; i < balances.length; i++) {
3216
3231
  const balance = balances[i];
@@ -3240,10 +3255,12 @@ export default class binance extends Exchange {
3240
3255
  * @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data // swap
3241
3256
  * @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data // future
3242
3257
  * @see https://binance-docs.github.io/apidocs/voptions/en/#option-account-information-trade // option
3258
+ * @see https://binance-docs.github.io/apidocs/pm/en/#account-balance-user_data // portfolio margin
3243
3259
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3244
- * @param {string} [params.type] 'future', 'delivery', 'savings', 'funding', or 'spot'
3260
+ * @param {string} [params.type] 'future', 'delivery', 'savings', 'funding', or 'spot' or 'papi'
3245
3261
  * @param {string} [params.marginMode] 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null
3246
3262
  * @param {string[]|undefined} [params.symbols] unified market symbols, only used in isolated margin mode
3263
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the balance for a portfolio margin account
3247
3264
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
3248
3265
  */
3249
3266
  await this.loadMarkets();
@@ -3251,13 +3268,19 @@ export default class binance extends Exchange {
3251
3268
  let type = this.safeString(params, 'type', defaultType);
3252
3269
  let subType = undefined;
3253
3270
  [subType, params] = this.handleSubTypeAndParams('fetchBalance', undefined, params);
3271
+ let isPortfolioMargin = undefined;
3272
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchBalance', 'papi', 'portfolioMargin', false);
3254
3273
  let marginMode = undefined;
3255
3274
  let query = undefined;
3256
3275
  [marginMode, query] = this.handleMarginModeAndParams('fetchBalance', params);
3257
3276
  query = this.omit(query, 'type');
3258
3277
  let response = undefined;
3259
3278
  const request = {};
3260
- if (this.isLinear(type, subType)) {
3279
+ if (isPortfolioMargin || (type === 'papi')) {
3280
+ type = 'papi';
3281
+ response = await this.papiGetBalance(this.extend(request, query));
3282
+ }
3283
+ else if (this.isLinear(type, subType)) {
3261
3284
  type = 'linear';
3262
3285
  response = await this.fapiPrivateV2GetAccount(this.extend(request, query));
3263
3286
  }
@@ -3266,7 +3289,7 @@ export default class binance extends Exchange {
3266
3289
  response = await this.dapiPrivateGetAccount(this.extend(request, query));
3267
3290
  }
3268
3291
  else if (marginMode === 'isolated') {
3269
- const paramSymbols = this.safeValue(params, 'symbols');
3292
+ const paramSymbols = this.safeList(params, 'symbols');
3270
3293
  query = this.omit(query, 'symbols');
3271
3294
  if (paramSymbols !== undefined) {
3272
3295
  let symbols = '';
@@ -3482,7 +3505,27 @@ export default class binance extends Exchange {
3482
3505
  // }
3483
3506
  // ]
3484
3507
  //
3485
- return this.parseBalance(response, type, marginMode);
3508
+ // portfolio margin
3509
+ //
3510
+ // [
3511
+ // {
3512
+ // "asset": "USDT",
3513
+ // "totalWalletBalance": "66.9923261",
3514
+ // "crossMarginAsset": "35.9697141",
3515
+ // "crossMarginBorrowed": "0.0",
3516
+ // "crossMarginFree": "35.9697141",
3517
+ // "crossMarginInterest": "0.0",
3518
+ // "crossMarginLocked": "0.0",
3519
+ // "umWalletBalance": "31.022612",
3520
+ // "umUnrealizedPNL": "0.0",
3521
+ // "cmWalletBalance": "0.0",
3522
+ // "cmUnrealizedPNL": "0.0",
3523
+ // "updateTime": 0,
3524
+ // "negativeBalance": "0.0"
3525
+ // },
3526
+ // ]
3527
+ //
3528
+ return this.parseBalanceCustom(response, type, marginMode);
3486
3529
  }
3487
3530
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
3488
3531
  /**
@@ -5254,7 +5297,7 @@ export default class binance extends Exchange {
5254
5297
  const stopLossPrice = this.safeValue(params, 'stopLossPrice', triggerPrice); // fallback to stopLoss
5255
5298
  const takeProfitPrice = this.safeValue(params, 'takeProfitPrice');
5256
5299
  const trailingDelta = this.safeValue(params, 'trailingDelta');
5257
- const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activationPrice', price);
5300
+ const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activationPrice', this.numberToString(price));
5258
5301
  const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRate');
5259
5302
  const isTrailingPercentOrder = trailingPercent !== undefined;
5260
5303
  const isStopLoss = stopLossPrice !== undefined || trailingDelta !== undefined;
@@ -9587,7 +9630,7 @@ export default class binance extends Exchange {
9587
9630
  }
9588
9631
  return this.safeValue(config, 'cost', 1);
9589
9632
  }
9590
- async request(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined, config = {}, context = {}) {
9633
+ async request(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined, config = {}) {
9591
9634
  const response = await this.fetch2(path, api, method, params, headers, body, config);
9592
9635
  // a workaround for {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
9593
9636
  if (api === 'private') {
@@ -10220,6 +10263,7 @@ export default class binance extends Exchange {
10220
10263
  else {
10221
10264
  return this.parseOpenInterest(response, market);
10222
10265
  }
10266
+ return undefined;
10223
10267
  }
10224
10268
  parseOpenInterest(interest, market = undefined) {
10225
10269
  const timestamp = this.safeInteger2(interest, 'timestamp', 'time');
package/js/src/bingx.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bingx.js';
2
- import type { Int, OrderSide, OHLCV, FundingRateHistory, Order, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, OHLCV, FundingRateHistory, Order, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position } from './base/types.js';
3
3
  /**
4
4
  * @class bingx
5
5
  * @augments Exchange
@@ -69,8 +69,8 @@ export default class bingx extends Exchange {
69
69
  createMarketOrderWithCost(symbol: string, side: OrderSide, cost: any, params?: {}): Promise<Order>;
70
70
  createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
71
71
  createMarketSellOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
72
- createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): any;
73
- createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
72
+ createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): any;
73
+ createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
74
74
  createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
75
75
  parseOrderSide(side: any): string;
76
76
  parseOrder(order: any, market?: Market): Order;
@@ -81,17 +81,7 @@ export default class bingx extends Exchange {
81
81
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
82
82
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
83
83
  fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
84
- transfer(code: string, amount: any, fromAccount: any, toAccount: any, params?: {}): Promise<{
85
- info: any;
86
- id: string;
87
- timestamp: any;
88
- datetime: any;
89
- currency: string;
90
- amount: any;
91
- fromAccount: any;
92
- toAccount: any;
93
- status: any;
94
- }>;
84
+ transfer(code: string, amount: number, fromAccount: any, toAccount: any, params?: {}): Promise<TransferEntry>;
95
85
  fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
96
86
  parseTransfer(transfer: any, currency?: Currency): {
97
87
  info: any;
@@ -119,7 +109,7 @@ export default class bingx extends Exchange {
119
109
  setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
120
110
  setMargin(symbol: string, amount: any, params?: {}): Promise<any>;
121
111
  fetchLeverage(symbol: string, params?: {}): Promise<any>;
122
- setLeverage(leverage: any, symbol?: Str, params?: {}): Promise<any>;
112
+ setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
123
113
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
124
114
  parseDepositWithdrawFee(fee: any, currency?: Currency): {
125
115
  info: any;
@@ -134,7 +124,7 @@ export default class bingx extends Exchange {
134
124
  networks: {};
135
125
  };
136
126
  fetchDepositWithdrawFees(codes?: Strings, params?: {}): Promise<any>;
137
- withdraw(code: string, amount: any, address: any, tag?: any, params?: {}): Promise<void>;
127
+ withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
138
128
  parseParams(params: any): {};
139
129
  fetchMyLiquidations(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Liquidation[]>;
140
130
  parseLiquidation(liquidation: any, market?: Market): import("./base/types.js").Liquidation;