ccxt 4.4.49 → 4.4.53

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 (158) hide show
  1. package/README.md +6 -3
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/alpaca.js +65 -2
  5. package/dist/cjs/src/base/Exchange.js +112 -3
  6. package/dist/cjs/src/binance.js +42 -19
  7. package/dist/cjs/src/bitfinex1.js +22 -22
  8. package/dist/cjs/src/blofin.js +6 -2
  9. package/dist/cjs/src/bybit.js +2 -2
  10. package/dist/cjs/src/coinex.js +5 -5
  11. package/dist/cjs/src/coinmetro.js +21 -4
  12. package/dist/cjs/src/defx.js +1 -1
  13. package/dist/cjs/src/deribit.js +23 -4
  14. package/dist/cjs/src/ellipx.js +1 -0
  15. package/dist/cjs/src/gate.js +2 -2
  16. package/dist/cjs/src/hollaex.js +15 -20
  17. package/dist/cjs/src/htx.js +6 -4
  18. package/dist/cjs/src/hyperliquid.js +4 -4
  19. package/dist/cjs/src/krakenfutures.js +1 -1
  20. package/dist/cjs/src/kucoin.js +52 -74
  21. package/dist/cjs/src/kuna.js +1 -1
  22. package/dist/cjs/src/mexc.js +29 -8
  23. package/dist/cjs/src/okcoin.js +13 -5
  24. package/dist/cjs/src/okx.js +1 -1
  25. package/dist/cjs/src/onetrading.js +1 -1
  26. package/dist/cjs/src/paradex.js +2 -2
  27. package/dist/cjs/src/paymium.js +42 -0
  28. package/dist/cjs/src/pro/binance.js +2 -0
  29. package/dist/cjs/src/pro/bitfinex1.js +4 -4
  30. package/dist/cjs/src/pro/bitvavo.js +1 -1
  31. package/dist/cjs/src/pro/blofin.js +9 -1
  32. package/dist/cjs/src/pro/bybit.js +1 -1
  33. package/dist/cjs/src/pro/coincatch.js +2 -2
  34. package/dist/cjs/src/pro/coinex.js +4 -1
  35. package/dist/cjs/src/pro/cryptocom.js +2 -2
  36. package/dist/cjs/src/pro/defx.js +1 -1
  37. package/dist/cjs/src/pro/exmo.js +1 -1
  38. package/dist/cjs/src/pro/gemini.js +1 -1
  39. package/dist/cjs/src/pro/hashkey.js +2 -2
  40. package/dist/cjs/src/pro/htx.js +8 -8
  41. package/dist/cjs/src/pro/hyperliquid.js +2 -2
  42. package/dist/cjs/src/pro/kucoin.js +1 -1
  43. package/dist/cjs/src/pro/okx.js +1 -1
  44. package/dist/cjs/src/pro/oxfun.js +1 -1
  45. package/dist/cjs/src/probit.js +77 -9
  46. package/dist/cjs/src/timex.js +67 -0
  47. package/dist/cjs/src/tokocrypto.js +82 -5
  48. package/dist/cjs/src/tradeogre.js +55 -2
  49. package/dist/cjs/src/vertex.js +65 -2
  50. package/dist/cjs/src/wavesexchange.js +73 -0
  51. package/dist/cjs/src/wazirx.js +59 -3
  52. package/dist/cjs/src/whitebit.js +80 -4
  53. package/dist/cjs/src/xt.js +112 -0
  54. package/dist/cjs/src/yobit.js +56 -0
  55. package/dist/cjs/src/zaif.js +55 -0
  56. package/dist/cjs/src/zonda.js +56 -0
  57. package/examples/README.md +6 -0
  58. package/js/ccxt.d.ts +1 -1
  59. package/js/ccxt.js +1 -1
  60. package/js/src/abstract/binance.d.ts +1 -0
  61. package/js/src/abstract/binancecoinm.d.ts +1 -0
  62. package/js/src/abstract/binanceus.d.ts +1 -0
  63. package/js/src/abstract/binanceusdm.d.ts +1 -0
  64. package/js/src/alpaca.d.ts +35 -0
  65. package/js/src/alpaca.js +65 -2
  66. package/js/src/base/Exchange.d.ts +2 -0
  67. package/js/src/base/Exchange.js +112 -3
  68. package/js/src/binance.d.ts +4 -1
  69. package/js/src/binance.js +42 -19
  70. package/js/src/bitfinex1.d.ts +22 -22
  71. package/js/src/bitfinex1.js +22 -22
  72. package/js/src/blofin.d.ts +1 -1
  73. package/js/src/blofin.js +6 -2
  74. package/js/src/bybit.d.ts +2 -2
  75. package/js/src/bybit.js +2 -2
  76. package/js/src/coinex.js +5 -5
  77. package/js/src/coinmetro.d.ts +1 -1
  78. package/js/src/coinmetro.js +21 -4
  79. package/js/src/defx.d.ts +1 -1
  80. package/js/src/defx.js +1 -1
  81. package/js/src/deribit.d.ts +1 -1
  82. package/js/src/deribit.js +23 -4
  83. package/js/src/ellipx.d.ts +1 -0
  84. package/js/src/ellipx.js +1 -0
  85. package/js/src/gate.d.ts +1 -1
  86. package/js/src/gate.js +2 -2
  87. package/js/src/hollaex.d.ts +2 -1
  88. package/js/src/hollaex.js +15 -20
  89. package/js/src/htx.d.ts +1 -1
  90. package/js/src/htx.js +6 -4
  91. package/js/src/hyperliquid.d.ts +3 -3
  92. package/js/src/hyperliquid.js +4 -4
  93. package/js/src/krakenfutures.d.ts +1 -1
  94. package/js/src/krakenfutures.js +1 -1
  95. package/js/src/kucoin.js +52 -74
  96. package/js/src/kuna.d.ts +1 -1
  97. package/js/src/kuna.js +1 -1
  98. package/js/src/mexc.d.ts +1 -1
  99. package/js/src/mexc.js +29 -8
  100. package/js/src/okcoin.js +13 -5
  101. package/js/src/okx.d.ts +1 -1
  102. package/js/src/okx.js +1 -1
  103. package/js/src/onetrading.d.ts +1 -1
  104. package/js/src/onetrading.js +1 -1
  105. package/js/src/paradex.d.ts +1 -1
  106. package/js/src/paradex.js +2 -2
  107. package/js/src/paymium.js +42 -0
  108. package/js/src/pro/binance.js +2 -0
  109. package/js/src/pro/bitfinex1.d.ts +4 -4
  110. package/js/src/pro/bitfinex1.js +4 -4
  111. package/js/src/pro/bitvavo.d.ts +1 -1
  112. package/js/src/pro/bitvavo.js +1 -1
  113. package/js/src/pro/blofin.d.ts +1 -1
  114. package/js/src/pro/blofin.js +9 -1
  115. package/js/src/pro/bybit.d.ts +1 -1
  116. package/js/src/pro/bybit.js +1 -1
  117. package/js/src/pro/coincatch.d.ts +2 -2
  118. package/js/src/pro/coincatch.js +2 -2
  119. package/js/src/pro/coinex.js +4 -1
  120. package/js/src/pro/cryptocom.d.ts +2 -2
  121. package/js/src/pro/cryptocom.js +2 -2
  122. package/js/src/pro/defx.d.ts +1 -1
  123. package/js/src/pro/defx.js +1 -1
  124. package/js/src/pro/exmo.d.ts +1 -1
  125. package/js/src/pro/exmo.js +1 -1
  126. package/js/src/pro/gemini.d.ts +1 -1
  127. package/js/src/pro/gemini.js +1 -1
  128. package/js/src/pro/hashkey.d.ts +2 -2
  129. package/js/src/pro/hashkey.js +2 -2
  130. package/js/src/pro/htx.d.ts +8 -8
  131. package/js/src/pro/htx.js +8 -8
  132. package/js/src/pro/hyperliquid.d.ts +2 -2
  133. package/js/src/pro/hyperliquid.js +2 -2
  134. package/js/src/pro/kucoin.d.ts +1 -1
  135. package/js/src/pro/kucoin.js +1 -1
  136. package/js/src/pro/okx.d.ts +1 -1
  137. package/js/src/pro/okx.js +1 -1
  138. package/js/src/pro/oxfun.d.ts +1 -1
  139. package/js/src/pro/oxfun.js +1 -1
  140. package/js/src/probit.d.ts +1 -0
  141. package/js/src/probit.js +77 -9
  142. package/js/src/timex.js +67 -0
  143. package/js/src/tokocrypto.d.ts +2 -3
  144. package/js/src/tokocrypto.js +82 -5
  145. package/js/src/tradeogre.d.ts +4 -2
  146. package/js/src/tradeogre.js +55 -2
  147. package/js/src/vertex.js +65 -2
  148. package/js/src/wavesexchange.js +73 -0
  149. package/js/src/wazirx.js +59 -3
  150. package/js/src/whitebit.js +80 -4
  151. package/js/src/xt.js +112 -0
  152. package/js/src/yobit.js +56 -0
  153. package/js/src/zaif.js +55 -0
  154. package/js/src/zonda.d.ts +1 -0
  155. package/js/src/zonda.js +56 -0
  156. package/package.json +2 -2
  157. package/js/src/hitbtc3.d.ts +0 -8
  158. package/js/src/hitbtc3.js +0 -20
@@ -673,6 +673,118 @@ class xt extends xt$1 {
673
673
  'createMarketBuyOrderRequiresPrice': true,
674
674
  'recvWindow': '5000', // in milliseconds, spot only
675
675
  },
676
+ 'features': {
677
+ 'default': {
678
+ 'sandbox': false,
679
+ 'createOrder': {
680
+ 'marginMode': false,
681
+ 'triggerPrice': false,
682
+ 'triggerDirection': false,
683
+ 'triggerPriceType': undefined,
684
+ 'stopLossPrice': false,
685
+ 'takeProfitPrice': false,
686
+ 'attachedStopLossTakeProfit': undefined,
687
+ 'timeInForce': {
688
+ 'IOC': true,
689
+ 'FOK': true,
690
+ 'PO': true,
691
+ 'GTD': false,
692
+ },
693
+ 'hedged': false,
694
+ 'trailing': false,
695
+ 'leverage': false,
696
+ 'marketBuyByCost': true,
697
+ 'marketBuyRequiresPrice': false,
698
+ 'selfTradePrevention': false,
699
+ 'iceberg': false,
700
+ },
701
+ 'createOrders': undefined,
702
+ 'fetchMyTrades': {
703
+ 'marginMode': true,
704
+ 'limit': 100,
705
+ 'daysBack': 100000,
706
+ 'untilDays': 100000,
707
+ 'marketType': true,
708
+ 'subType': true,
709
+ },
710
+ 'fetchOrder': {
711
+ 'marginMode': false,
712
+ 'trigger': true,
713
+ 'trailing': false,
714
+ 'marketType': true,
715
+ 'subType': true,
716
+ },
717
+ 'fetchOpenOrders': {
718
+ 'marginMode': true,
719
+ 'limit': 100,
720
+ 'trigger': true,
721
+ 'trailing': false,
722
+ 'marketType': true,
723
+ 'subType': true,
724
+ },
725
+ 'fetchOrders': {
726
+ 'marginMode': true,
727
+ 'limit': 100,
728
+ 'daysBack': 100000,
729
+ 'untilDays': 100000,
730
+ 'trigger': true,
731
+ 'trailing': false,
732
+ 'marketType': true,
733
+ 'subType': true,
734
+ },
735
+ 'fetchClosedOrders': {
736
+ 'marginMode': true,
737
+ 'limit': 100,
738
+ 'daysBack': 100000,
739
+ 'daysBackCanceled': 1,
740
+ 'untilDays': 100000,
741
+ 'trigger': true,
742
+ 'trailing': false,
743
+ 'marketType': true,
744
+ 'subType': true,
745
+ },
746
+ 'fetchOHLCV': {
747
+ 'limit': 1000, // todo for derivatives
748
+ },
749
+ },
750
+ 'spot': {
751
+ 'extends': 'default',
752
+ },
753
+ 'forDerivatives': {
754
+ 'extends': 'default',
755
+ 'createOrder': {
756
+ 'triggerPrice': true,
757
+ // todo
758
+ 'triggerPriceType': {
759
+ 'last': true,
760
+ 'mark': true,
761
+ 'index': true,
762
+ },
763
+ 'stopLossPrice': true,
764
+ 'takeProfitPrice': true,
765
+ },
766
+ 'fetchMyTrades': {
767
+ 'daysBack': undefined,
768
+ 'untilDays': undefined,
769
+ },
770
+ },
771
+ 'swap': {
772
+ 'linear': {
773
+ 'extends': 'forDerivatives',
774
+ },
775
+ 'inverse': {
776
+ 'extends': 'forDerivatives',
777
+ },
778
+ },
779
+ 'future': {
780
+ 'linear': {
781
+ 'extends': 'forDerivatives',
782
+ },
783
+ 'inverse': {
784
+ 'extends': 'forDerivatives',
785
+ },
786
+ },
787
+ },
676
788
  });
677
789
  }
678
790
  nonce() {
@@ -308,6 +308,62 @@ class yobit extends yobit$1 {
308
308
  'Rate Limited': errors.RateLimitExceeded,
309
309
  },
310
310
  },
311
+ 'features': {
312
+ 'spot': {
313
+ 'sandbox': false,
314
+ 'createOrder': {
315
+ 'marginMode': false,
316
+ 'triggerPrice': false,
317
+ 'triggerDirection': false,
318
+ 'triggerPriceType': undefined,
319
+ 'stopLossPrice': false,
320
+ 'takeProfitPrice': false,
321
+ 'attachedStopLossTakeProfit': undefined,
322
+ 'timeInForce': {
323
+ 'IOC': false,
324
+ 'FOK': false,
325
+ 'PO': false,
326
+ 'GTD': false,
327
+ },
328
+ 'hedged': false,
329
+ 'trailing': false,
330
+ 'leverage': false,
331
+ 'marketBuyByCost': false,
332
+ 'marketBuyRequiresPrice': false,
333
+ 'selfTradePrevention': false,
334
+ 'iceberg': false,
335
+ },
336
+ 'createOrders': undefined,
337
+ 'fetchMyTrades': {
338
+ 'marginMode': false,
339
+ 'limit': 1000,
340
+ 'daysBack': 100000,
341
+ 'untilDays': 100000, // todo
342
+ },
343
+ 'fetchOrder': {
344
+ 'marginMode': false,
345
+ 'trigger': false,
346
+ 'trailing': false,
347
+ },
348
+ 'fetchOpenOrders': {
349
+ 'marginMode': false,
350
+ 'limit': undefined,
351
+ 'trigger': false,
352
+ 'trailing': false,
353
+ },
354
+ 'fetchOrders': undefined,
355
+ 'fetchClosedOrders': undefined,
356
+ 'fetchOHLCV': undefined,
357
+ },
358
+ 'swap': {
359
+ 'linear': undefined,
360
+ 'inverse': undefined,
361
+ },
362
+ 'future': {
363
+ 'linear': undefined,
364
+ 'inverse': undefined,
365
+ },
366
+ },
311
367
  'orders': {}, // orders cache / emulation
312
368
  });
313
369
  }
@@ -129,6 +129,61 @@ class zaif extends zaif$1 {
129
129
  },
130
130
  },
131
131
  'options': {},
132
+ 'features': {
133
+ 'spot': {
134
+ 'sandbox': false,
135
+ 'createOrder': {
136
+ 'marginMode': true,
137
+ 'triggerPrice': true,
138
+ 'triggerDirection': false,
139
+ 'triggerPriceType': undefined,
140
+ 'stopLossPrice': false,
141
+ 'takeProfitPrice': false,
142
+ 'attachedStopLossTakeProfit': undefined,
143
+ 'timeInForce': {
144
+ 'IOC': false,
145
+ 'FOK': false,
146
+ 'PO': false,
147
+ 'GTD': false,
148
+ },
149
+ 'hedged': false,
150
+ 'trailing': false,
151
+ 'leverage': true,
152
+ 'marketBuyByCost': false,
153
+ 'marketBuyRequiresPrice': false,
154
+ 'selfTradePrevention': false,
155
+ 'iceberg': false,
156
+ },
157
+ 'createOrders': undefined,
158
+ 'fetchMyTrades': undefined,
159
+ 'fetchOrder': undefined,
160
+ 'fetchOpenOrders': {
161
+ 'marginMode': true,
162
+ 'limit': undefined,
163
+ 'trigger': false,
164
+ 'trailing': false,
165
+ },
166
+ 'fetchOrders': undefined,
167
+ 'fetchClosedOrders': {
168
+ 'marginMode': true,
169
+ 'limit': 1000,
170
+ 'daysBack': 100000,
171
+ 'daysBackCanceled': 1,
172
+ 'untilDays': 100000,
173
+ 'trigger': false,
174
+ 'trailing': false,
175
+ },
176
+ 'fetchOHLCV': undefined,
177
+ },
178
+ 'swap': {
179
+ 'linear': undefined,
180
+ 'inverse': undefined,
181
+ },
182
+ 'future': {
183
+ 'linear': undefined,
184
+ 'inverse': undefined,
185
+ },
186
+ },
132
187
  'precisionMode': number.TICK_SIZE,
133
188
  'exceptions': {
134
189
  'exact': {
@@ -289,6 +289,60 @@ class zonda extends zonda$1 {
289
289
  'fillResponseFromRequest': true,
290
290
  },
291
291
  },
292
+ 'features': {
293
+ 'spot': {
294
+ 'sandbox': false,
295
+ 'createOrder': {
296
+ 'marginMode': false,
297
+ 'triggerPrice': true,
298
+ 'triggerDirection': false,
299
+ 'triggerPriceType': undefined,
300
+ 'stopLossPrice': false,
301
+ 'takeProfitPrice': false,
302
+ 'attachedStopLossTakeProfit': undefined,
303
+ 'timeInForce': {
304
+ 'IOC': true,
305
+ 'FOK': true,
306
+ 'PO': true,
307
+ 'GTD': false,
308
+ },
309
+ 'hedged': false,
310
+ 'trailing': false,
311
+ 'leverage': false,
312
+ 'marketBuyByCost': true,
313
+ 'marketBuyRequiresPrice': false,
314
+ 'selfTradePrevention': false,
315
+ 'iceberg': false,
316
+ },
317
+ 'createOrders': undefined,
318
+ 'fetchMyTrades': {
319
+ 'marginMode': false,
320
+ 'limit': undefined,
321
+ 'daysBack': 100000,
322
+ 'untilDays': 100000, // todo
323
+ },
324
+ 'fetchOrder': undefined,
325
+ 'fetchOpenOrders': {
326
+ 'marginMode': false,
327
+ 'limit': 100,
328
+ 'trigger': false,
329
+ 'trailing': false,
330
+ },
331
+ 'fetchOrders': undefined,
332
+ 'fetchClosedOrders': undefined,
333
+ 'fetchOHLCV': {
334
+ 'limit': undefined,
335
+ },
336
+ },
337
+ 'swap': {
338
+ 'linear': undefined,
339
+ 'inverse': undefined,
340
+ },
341
+ 'future': {
342
+ 'linear': undefined,
343
+ 'inverse': undefined,
344
+ },
345
+ },
292
346
  'precisionMode': number.TICK_SIZE,
293
347
  'exceptions': {
294
348
  '400': errors.ExchangeError,
@@ -442,6 +496,7 @@ class zonda extends zonda$1 {
442
496
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
443
497
  await this.loadMarkets();
444
498
  const request = {};
499
+ // todo pair
445
500
  const response = await this.v1_01PrivateGetTradingOffer(this.extend(request, params));
446
501
  const items = this.safeList(response, 'items', []);
447
502
  return this.parseOrders(items, undefined, since, limit, { 'status': 'open' });
@@ -1375,6 +1430,7 @@ class zonda extends zonda$1 {
1375
1430
  * @method
1376
1431
  * @name zonda#createOrder
1377
1432
  * @description create a trade order
1433
+ * @see https://docs.zondacrypto.exchange/reference/new-order
1378
1434
  * @param {string} symbol unified symbol of the market to create an order in
1379
1435
  * @param {string} type 'market' or 'limit'
1380
1436
  * @param {string} side 'buy' or 'sell'
@@ -54,6 +54,8 @@ python path/to/example.py # substitute for actual filename here
54
54
 
55
55
  ## See Also
56
56
 
57
+ This section includes links to friendly projects, tutorials, articles, videos, courses and other materials related to CCXT.
58
+
57
59
  [Freqtrade](https://www.freqtrade.io) – leading opensource cryptocurrency algorithmic trading software based on CCXT!
58
60
 
59
61
  [Blockpit](https://www.blockpit.io) – Tax reporting and portfolio tracking for Cryptocurrencies, Cryptoderivates and DeFi.
@@ -66,6 +68,10 @@ python path/to/example.py # substitute for actual filename here
66
68
 
67
69
  [Playing with CCXT in Google Colab](https://medium.com/@ccxt/playing-with-ccxt-in-google-colab-23522ac8a6cb) – An article on how useful Colab can be for quick prototyping and testing your trading ideas with CCXT.
68
70
 
71
+ [Ultimate Guide to Mastering Cryptocurrency Trading Orders with Python](https://robottraders.io/blog/guide-ccxt-orders) – A great tutorial on trading orders with CCXT by Robot Traders.
72
+
73
+ [Mastering Cryptocurrency Trading: From Data to Strategy with Python](https://profitview.net/blog/mastering-cryptocurrency-trading-from-data-to-strategy-with-python) – An in-depth article guiding through trading strategy development with CCXT and Python.
74
+
69
75
  [What is the Best Crypto Trading Bot in 2020?](https://www.hodlbot.io/blog/ultimate-guide-on-crypto-trading-bots) – Ultimate guide on crypto trading bots in 2020 by HodlBlog.
70
76
 
71
77
  [Enigma Catalyst](https://blog.enigma.co/enigma-announces-catalyst-0-4-our-biggest-release-yet-fa31a5ffa4b1) – The major effort towards decentralized exchanges integrates ccxt!
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, LongShortRatio, OpenInterests } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
7
- declare const version = "4.4.48";
7
+ declare const version = "4.4.52";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.4.49';
41
+ const version = '4.4.52';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -219,6 +219,7 @@ interface Exchange {
219
219
  sapiGetPortfolioRepayFuturesSwitch(params?: {}): Promise<implicitReturnType>;
220
220
  sapiGetPortfolioMarginAssetLeverage(params?: {}): Promise<implicitReturnType>;
221
221
  sapiGetPortfolioBalance(params?: {}): Promise<implicitReturnType>;
222
+ sapiGetPortfolioNegativeBalanceExchangeRecord(params?: {}): Promise<implicitReturnType>;
222
223
  sapiGetStakingProductList(params?: {}): Promise<implicitReturnType>;
223
224
  sapiGetStakingPosition(params?: {}): Promise<implicitReturnType>;
224
225
  sapiGetStakingStakingRecord(params?: {}): Promise<implicitReturnType>;
@@ -219,6 +219,7 @@ interface binance {
219
219
  sapiGetPortfolioRepayFuturesSwitch(params?: {}): Promise<implicitReturnType>;
220
220
  sapiGetPortfolioMarginAssetLeverage(params?: {}): Promise<implicitReturnType>;
221
221
  sapiGetPortfolioBalance(params?: {}): Promise<implicitReturnType>;
222
+ sapiGetPortfolioNegativeBalanceExchangeRecord(params?: {}): Promise<implicitReturnType>;
222
223
  sapiGetStakingProductList(params?: {}): Promise<implicitReturnType>;
223
224
  sapiGetStakingPosition(params?: {}): Promise<implicitReturnType>;
224
225
  sapiGetStakingStakingRecord(params?: {}): Promise<implicitReturnType>;
@@ -219,6 +219,7 @@ interface binance {
219
219
  sapiGetPortfolioRepayFuturesSwitch(params?: {}): Promise<implicitReturnType>;
220
220
  sapiGetPortfolioMarginAssetLeverage(params?: {}): Promise<implicitReturnType>;
221
221
  sapiGetPortfolioBalance(params?: {}): Promise<implicitReturnType>;
222
+ sapiGetPortfolioNegativeBalanceExchangeRecord(params?: {}): Promise<implicitReturnType>;
222
223
  sapiGetStakingProductList(params?: {}): Promise<implicitReturnType>;
223
224
  sapiGetStakingPosition(params?: {}): Promise<implicitReturnType>;
224
225
  sapiGetStakingStakingRecord(params?: {}): Promise<implicitReturnType>;
@@ -219,6 +219,7 @@ interface binance {
219
219
  sapiGetPortfolioRepayFuturesSwitch(params?: {}): Promise<implicitReturnType>;
220
220
  sapiGetPortfolioMarginAssetLeverage(params?: {}): Promise<implicitReturnType>;
221
221
  sapiGetPortfolioBalance(params?: {}): Promise<implicitReturnType>;
222
+ sapiGetPortfolioNegativeBalanceExchangeRecord(params?: {}): Promise<implicitReturnType>;
222
223
  sapiGetStakingProductList(params?: {}): Promise<implicitReturnType>;
223
224
  sapiGetStakingPosition(params?: {}): Promise<implicitReturnType>;
224
225
  sapiGetStakingStakingRecord(params?: {}): Promise<implicitReturnType>;
@@ -91,6 +91,40 @@ export default class alpaca extends Exchange {
91
91
  */
92
92
  fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
93
93
  generateClientOrderId(params: any): string;
94
+ /**
95
+ * @method
96
+ * @name alpaca#createMarketOrderWithCost
97
+ * @description create a market order by providing the symbol, side and cost
98
+ * @see https://docs.alpaca.markets/reference/postorder
99
+ * @param {string} symbol unified symbol of the market to create an order in
100
+ * @param {string} side 'buy' or 'sell'
101
+ * @param {float} cost how much you want to trade in units of the quote currency
102
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
103
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
104
+ */
105
+ createMarketOrderWithCost(symbol: string, side: OrderSide, cost: number, params?: {}): Promise<Order>;
106
+ /**
107
+ * @method
108
+ * @name alpaca#createMarketBuyOrderWithCost
109
+ * @description create a market buy order by providing the symbol and cost
110
+ * @see https://docs.alpaca.markets/reference/postorder
111
+ * @param {string} symbol unified symbol of the market to create an order in
112
+ * @param {float} cost how much you want to trade in units of the quote currency
113
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
114
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
115
+ */
116
+ createMarketBuyOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
117
+ /**
118
+ * @method
119
+ * @name alpaca#createMarketSellOrderWithCost
120
+ * @description create a market sell order by providing the symbol and cost
121
+ * @see https://docs.alpaca.markets/reference/postorder
122
+ * @param {string} symbol unified symbol of the market to create an order in
123
+ * @param {float} cost how much you want to trade in units of the quote currency
124
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
125
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
126
+ */
127
+ createMarketSellOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
94
128
  /**
95
129
  * @method
96
130
  * @name alpaca#createOrder
@@ -103,6 +137,7 @@ export default class alpaca extends Exchange {
103
137
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
104
138
  * @param {object} [params] extra parameters specific to the exchange API endpoint
105
139
  * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
140
+ * @param {float} [params.cost] *market orders only* the cost of the order in units of the quote currency
106
141
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
107
142
  */
108
143
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
package/js/src/alpaca.js CHANGED
@@ -53,6 +53,9 @@ export default class alpaca extends Exchange {
53
53
  'cancelOrder': true,
54
54
  'closeAllPositions': false,
55
55
  'closePosition': false,
56
+ 'createMarketBuyOrder': true,
57
+ 'createMarketBuyOrderWithCost': true,
58
+ 'createMarketOrderWithCost': true,
56
59
  'createOrder': true,
57
60
  'createStopOrder': true,
58
61
  'createTriggerOrder': true,
@@ -436,7 +439,7 @@ export default class alpaca extends Exchange {
436
439
  // "status": "active",
437
440
  // "tradable": true,
438
441
  // "marginable": false,
439
- // "maintenance_margin_requirement": 100,
442
+ // "maintenance_margin_requirement": 101,
440
443
  // "shortable": false,
441
444
  // "easy_to_borrow": false,
442
445
  // "fractionable": true,
@@ -912,6 +915,58 @@ export default class alpaca extends Exchange {
912
915
  const clientOrderId = this.safeString(params, 'clientOrderId', defaultClientId);
913
916
  return clientOrderId;
914
917
  }
918
+ /**
919
+ * @method
920
+ * @name alpaca#createMarketOrderWithCost
921
+ * @description create a market order by providing the symbol, side and cost
922
+ * @see https://docs.alpaca.markets/reference/postorder
923
+ * @param {string} symbol unified symbol of the market to create an order in
924
+ * @param {string} side 'buy' or 'sell'
925
+ * @param {float} cost how much you want to trade in units of the quote currency
926
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
927
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
928
+ */
929
+ async createMarketOrderWithCost(symbol, side, cost, params = {}) {
930
+ await this.loadMarkets();
931
+ const req = {
932
+ 'cost': cost,
933
+ };
934
+ return await this.createOrder(symbol, 'market', side, 0, undefined, this.extend(req, params));
935
+ }
936
+ /**
937
+ * @method
938
+ * @name alpaca#createMarketBuyOrderWithCost
939
+ * @description create a market buy order by providing the symbol and cost
940
+ * @see https://docs.alpaca.markets/reference/postorder
941
+ * @param {string} symbol unified symbol of the market to create an order in
942
+ * @param {float} cost how much you want to trade in units of the quote currency
943
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
944
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
945
+ */
946
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
947
+ await this.loadMarkets();
948
+ const req = {
949
+ 'cost': cost,
950
+ };
951
+ return await this.createOrder(symbol, 'market', 'buy', 0, undefined, this.extend(req, params));
952
+ }
953
+ /**
954
+ * @method
955
+ * @name alpaca#createMarketSellOrderWithCost
956
+ * @description create a market sell order by providing the symbol and cost
957
+ * @see https://docs.alpaca.markets/reference/postorder
958
+ * @param {string} symbol unified symbol of the market to create an order in
959
+ * @param {float} cost how much you want to trade in units of the quote currency
960
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
961
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
962
+ */
963
+ async createMarketSellOrderWithCost(symbol, cost, params = {}) {
964
+ await this.loadMarkets();
965
+ const req = {
966
+ 'cost': cost,
967
+ };
968
+ return await this.createOrder(symbol, 'market', 'sell', cost, undefined, this.extend(req, params));
969
+ }
915
970
  /**
916
971
  * @method
917
972
  * @name alpaca#createOrder
@@ -924,6 +979,7 @@ export default class alpaca extends Exchange {
924
979
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
925
980
  * @param {object} [params] extra parameters specific to the exchange API endpoint
926
981
  * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
982
+ * @param {float} [params.cost] *market orders only* the cost of the order in units of the quote currency
927
983
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
928
984
  */
929
985
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -932,7 +988,6 @@ export default class alpaca extends Exchange {
932
988
  const id = market['id'];
933
989
  const request = {
934
990
  'symbol': id,
935
- 'qty': this.amountToPrecision(symbol, amount),
936
991
  'side': side,
937
992
  'type': type, // market, limit, stop_limit
938
993
  };
@@ -951,6 +1006,14 @@ export default class alpaca extends Exchange {
951
1006
  if (type.indexOf('limit') >= 0) {
952
1007
  request['limit_price'] = this.priceToPrecision(symbol, price);
953
1008
  }
1009
+ const cost = this.safeString(params, 'cost');
1010
+ if (cost !== undefined) {
1011
+ params = this.omit(params, 'cost');
1012
+ request['notional'] = this.costToPrecision(symbol, cost);
1013
+ }
1014
+ else {
1015
+ request['qty'] = this.amountToPrecision(symbol, amount);
1016
+ }
954
1017
  const defaultTIF = this.safeString(this.options, 'defaultTimeInForce');
955
1018
  request['time_in_force'] = this.safeString(params, 'timeInForce', defaultTIF);
956
1019
  params = this.omit(params, ['timeInForce', 'triggerPrice']);
@@ -822,6 +822,7 @@ export default class Exchange {
822
822
  parseToInt(number: any): number;
823
823
  parseToNumeric(number: any): number;
824
824
  isRoundNumber(value: number): boolean;
825
+ safeNumberOmitZero(obj: object, key: IndexType, defaultValue?: Num): Num;
825
826
  safeIntegerOmitZero(obj: object, key: IndexType, defaultValue?: Int): Int;
826
827
  afterConstruct(): void;
827
828
  featuresGenerator(): void;
@@ -1128,6 +1129,7 @@ export default class Exchange {
1128
1129
  parseFundingRates(response: any, symbols?: Strings): FundingRates;
1129
1130
  parseLongShortRatio(info: Dict, market?: Market): LongShortRatio;
1130
1131
  parseLongShortRatioHistory(response: any, market?: any, since?: Int, limit?: Int): LongShortRatio[];
1132
+ handleTriggerDirectionAndParams(params: any, exchangeSpecificKey?: Str, allowEmpty?: Bool): any[];
1131
1133
  handleTriggerAndParams(params: any): any[];
1132
1134
  isTriggerOrder(params: any): any[];
1133
1135
  isPostOnly(isMarketOrder: boolean, exchangeSpecificParam: any, params?: {}): boolean;