ccxt 4.3.52 → 4.3.54

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 (51) hide show
  1. package/README.md +6 -5
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/vertex.js +9 -0
  5. package/dist/cjs/src/base/Precise.js +10 -0
  6. package/dist/cjs/src/base/functions/type.js +43 -10
  7. package/dist/cjs/src/bingx.js +1 -1
  8. package/dist/cjs/src/hyperliquid.js +27 -26
  9. package/dist/cjs/src/phemex.js +28 -1
  10. package/dist/cjs/src/poloniex.js +2 -1
  11. package/dist/cjs/src/pro/binance.js +1 -1
  12. package/dist/cjs/src/pro/bybit.js +20 -12
  13. package/dist/cjs/src/pro/kucoin.js +64 -26
  14. package/dist/cjs/src/pro/probit.js +8 -3
  15. package/dist/cjs/src/pro/vertex.js +978 -0
  16. package/dist/cjs/src/probit.js +10 -5
  17. package/dist/cjs/src/static_dependencies/ethers/hash/typed-data.js +1 -1
  18. package/dist/cjs/src/vertex.js +2941 -0
  19. package/dist/cjs/src/woo.js +29 -21
  20. package/js/ccxt.d.ts +8 -2
  21. package/js/ccxt.js +6 -2
  22. package/js/src/abstract/vertex.d.ts +22 -0
  23. package/js/src/abstract/vertex.js +11 -0
  24. package/js/src/base/Exchange.d.ts +1 -1
  25. package/js/src/base/Precise.d.ts +2 -0
  26. package/js/src/base/Precise.js +10 -0
  27. package/js/src/base/functions/type.js +43 -10
  28. package/js/src/binance.d.ts +1 -11
  29. package/js/src/bingx.js +1 -1
  30. package/js/src/bitget.d.ts +1 -1
  31. package/js/src/bitmart.d.ts +1 -1
  32. package/js/src/coinex.d.ts +1 -1
  33. package/js/src/htx.d.ts +1 -1
  34. package/js/src/hyperliquid.js +27 -26
  35. package/js/src/phemex.d.ts +1 -1
  36. package/js/src/phemex.js +28 -1
  37. package/js/src/poloniex.js +2 -1
  38. package/js/src/pro/binance.js +1 -1
  39. package/js/src/pro/bybit.d.ts +1 -1
  40. package/js/src/pro/bybit.js +20 -12
  41. package/js/src/pro/kucoin.js +64 -26
  42. package/js/src/pro/probit.js +8 -3
  43. package/js/src/pro/vertex.d.ts +39 -0
  44. package/js/src/pro/vertex.js +979 -0
  45. package/js/src/probit.js +11 -6
  46. package/js/src/static_dependencies/ethers/hash/typed-data.js +1 -1
  47. package/js/src/vertex.d.ts +112 -0
  48. package/js/src/vertex.js +2942 -0
  49. package/js/src/woo.d.ts +1 -0
  50. package/js/src/woo.js +29 -21
  51. package/package.json +1 -1
package/js/src/woo.d.ts CHANGED
@@ -22,6 +22,7 @@ export default class woo extends Exchange {
22
22
  fetchTradingFees(params?: {}): Promise<TradingFees>;
23
23
  fetchCurrencies(params?: {}): Promise<Currencies>;
24
24
  createMarketBuyOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
25
+ createMarketSellOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
25
26
  createTrailingAmountOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, trailingAmount?: any, trailingTriggerPrice?: any, params?: {}): Promise<Order>;
26
27
  createTrailingPercentOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, trailingPercent?: any, trailingTriggerPrice?: any, params?: {}): Promise<Order>;
27
28
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
package/js/src/woo.js CHANGED
@@ -45,7 +45,7 @@ export default class woo extends Exchange {
45
45
  'createMarketBuyOrderWithCost': true,
46
46
  'createMarketOrder': false,
47
47
  'createMarketOrderWithCost': false,
48
- 'createMarketSellOrderWithCost': false,
48
+ 'createMarketSellOrderWithCost': true,
49
49
  'createOrder': true,
50
50
  'createOrderWithTakeProfitAndStopLoss': true,
51
51
  'createReduceOnlyOrder': true,
@@ -853,8 +853,25 @@ export default class woo extends Exchange {
853
853
  if (!market['spot']) {
854
854
  throw new NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
855
855
  }
856
- params['createMarketBuyOrderRequiresPrice'] = false;
857
- return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
856
+ return await this.createOrder(symbol, 'market', 'buy', cost, 1, params);
857
+ }
858
+ async createMarketSellOrderWithCost(symbol, cost, params = {}) {
859
+ /**
860
+ * @method
861
+ * @name woo#createMarketSellOrderWithCost
862
+ * @description create a market sell order by providing the symbol and cost
863
+ * @see https://docs.woo.org/#send-order
864
+ * @param {string} symbol unified symbol of the market to create an order in
865
+ * @param {float} cost how much you want to trade in units of the quote currency
866
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
867
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
868
+ */
869
+ await this.loadMarkets();
870
+ const market = this.market(symbol);
871
+ if (!market['spot']) {
872
+ throw new NotSupported(this.id + ' createMarketSellOrderWithCost() supports spot orders only');
873
+ }
874
+ return await this.createOrder(symbol, 'market', 'sell', cost, 1, params);
858
875
  }
859
876
  async createTrailingAmountOrder(symbol, type, side, amount, price = undefined, trailingAmount = undefined, trailingTriggerPrice = undefined, params = {}) {
860
877
  /**
@@ -977,33 +994,24 @@ export default class woo extends Exchange {
977
994
  if (reduceOnly) {
978
995
  request[reduceOnlyKey] = reduceOnly;
979
996
  }
980
- if (price !== undefined) {
997
+ if (!isMarket && price !== undefined) {
981
998
  request[priceKey] = this.priceToPrecision(symbol, price);
982
999
  }
983
1000
  if (isMarket && !isStop) {
984
1001
  // for market buy it requires the amount of quote currency to spend
985
- if (market['spot'] && orderSide === 'BUY') {
1002
+ const cost = this.safeString2(params, 'cost', 'order_amount');
1003
+ params = this.omit(params, ['cost', 'order_amount']);
1004
+ const isPriceProvided = price !== undefined;
1005
+ if (market['spot'] && (isPriceProvided || (cost !== undefined))) {
986
1006
  let quoteAmount = undefined;
987
- let createMarketBuyOrderRequiresPrice = true;
988
- [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
989
- const cost = this.safeNumber2(params, 'cost', 'order_amount');
990
- params = this.omit(params, ['cost', 'order_amount']);
991
1007
  if (cost !== undefined) {
992
1008
  quoteAmount = this.costToPrecision(symbol, cost);
993
1009
  }
994
- else if (createMarketBuyOrderRequiresPrice) {
995
- if (price === undefined) {
996
- throw new InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend (quote quantity) in the amount argument');
997
- }
998
- else {
999
- const amountString = this.numberToString(amount);
1000
- const priceString = this.numberToString(price);
1001
- const costRequest = Precise.stringMul(amountString, priceString);
1002
- quoteAmount = this.costToPrecision(symbol, costRequest);
1003
- }
1004
- }
1005
1010
  else {
1006
- quoteAmount = this.costToPrecision(symbol, amount);
1011
+ const amountString = this.numberToString(amount);
1012
+ const priceString = this.numberToString(price);
1013
+ const costRequest = Precise.stringMul(amountString, priceString);
1014
+ quoteAmount = this.costToPrecision(symbol, costRequest);
1007
1015
  }
1008
1016
  request['order_amount'] = quoteAmount;
1009
1017
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.52",
3
+ "version": "4.3.54",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",