ccxt 4.4.22 → 4.4.23

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 (48) hide show
  1. package/README.md +112 -111
  2. package/dist/ccxt.browser.min.js +4 -4
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/coincatch.js +9 -0
  5. package/dist/cjs/src/binance.js +69 -44
  6. package/dist/cjs/src/bitfinex.js +4 -0
  7. package/dist/cjs/src/bitflyer.js +1 -0
  8. package/dist/cjs/src/bitrue.js +3 -0
  9. package/dist/cjs/src/bybit.js +2 -2
  10. package/dist/cjs/src/cex.js +4 -0
  11. package/dist/cjs/src/coinbase.js +1 -1
  12. package/dist/cjs/src/coinbaseexchange.js +3 -0
  13. package/dist/cjs/src/coincatch.js +5370 -0
  14. package/dist/cjs/src/coinex.js +63 -1
  15. package/dist/cjs/src/latoken.js +6 -0
  16. package/dist/cjs/src/mexc.js +1 -1
  17. package/dist/cjs/src/oceanex.js +2 -0
  18. package/dist/cjs/src/okcoin.js +1 -0
  19. package/dist/cjs/src/poloniex.js +5 -0
  20. package/dist/cjs/src/pro/coincatch.js +1554 -0
  21. package/js/ccxt.d.ts +8 -2
  22. package/js/ccxt.js +6 -2
  23. package/js/src/abstract/binance.d.ts +21 -0
  24. package/js/src/abstract/binancecoinm.d.ts +21 -0
  25. package/js/src/abstract/binanceus.d.ts +21 -0
  26. package/js/src/abstract/binanceusdm.d.ts +21 -0
  27. package/js/src/abstract/coincatch.d.ts +97 -0
  28. package/js/src/abstract/coincatch.js +11 -0
  29. package/js/src/binance.js +69 -44
  30. package/js/src/bitfinex.js +4 -0
  31. package/js/src/bitflyer.js +1 -0
  32. package/js/src/bitrue.js +3 -0
  33. package/js/src/bybit.js +2 -2
  34. package/js/src/cex.js +4 -0
  35. package/js/src/coinbase.js +1 -1
  36. package/js/src/coinbaseexchange.js +3 -0
  37. package/js/src/coincatch.d.ts +130 -0
  38. package/js/src/coincatch.js +5371 -0
  39. package/js/src/coinex.d.ts +1 -0
  40. package/js/src/coinex.js +63 -1
  41. package/js/src/latoken.js +6 -0
  42. package/js/src/mexc.js +1 -1
  43. package/js/src/oceanex.js +2 -0
  44. package/js/src/okcoin.js +1 -0
  45. package/js/src/poloniex.js +5 -0
  46. package/js/src/pro/coincatch.d.ts +57 -0
  47. package/js/src/pro/coincatch.js +1555 -0
  48. package/package.json +1 -1
@@ -104,6 +104,7 @@ export default class coinex extends Exchange {
104
104
  fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
105
105
  parseLeverage(leverage: Dict, market?: Market): Leverage;
106
106
  fetchPositionHistory(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
107
+ closePosition(symbol: string, side?: OrderSide, params?: {}): Promise<Order>;
107
108
  handleMarginModeAndParams(methodName: any, params?: {}, defaultValue?: any): any[];
108
109
  nonce(): number;
109
110
  sign(path: any, api?: any[], method?: string, params?: {}, headers?: any, body?: any): {
package/js/src/coinex.js CHANGED
@@ -48,6 +48,8 @@ export default class coinex extends Exchange {
48
48
  'cancelAllOrders': true,
49
49
  'cancelOrder': true,
50
50
  'cancelOrders': true,
51
+ 'closeAllPositions': false,
52
+ 'closePosition': true,
51
53
  'createDepositAddress': true,
52
54
  'createMarketBuyOrderWithCost': true,
53
55
  'createMarketOrderWithCost': false,
@@ -1775,7 +1777,7 @@ export default class coinex extends Exchange {
1775
1777
  // "stop_id": 117180138153
1776
1778
  // }
1777
1779
  //
1778
- // Swap createOrder, createOrders, editOrder, cancelOrders, cancelOrder, fetchOpenOrders, fetchClosedOrders
1780
+ // Swap createOrder, createOrders, editOrder, cancelOrders, cancelOrder, fetchOpenOrders, fetchClosedOrders, closePosition
1779
1781
  //
1780
1782
  // {
1781
1783
  // "amount": "0.0001",
@@ -5698,6 +5700,66 @@ export default class coinex extends Exchange {
5698
5700
  const positions = this.parsePositions(records);
5699
5701
  return this.filterBySymbolSinceLimit(positions, symbol, since, limit);
5700
5702
  }
5703
+ async closePosition(symbol, side = undefined, params = {}) {
5704
+ /**
5705
+ * @method
5706
+ * @name coinex#closePosition
5707
+ * @description closes an open position for a market
5708
+ * @see https://docs.coinex.com/api/v2/futures/position/http/close-position
5709
+ * @param {string} symbol unified CCXT market symbol
5710
+ * @param {string} [side] buy or sell, not used by coinex
5711
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
5712
+ * @param {string} params.type required by coinex, one of: limit, market, maker_only, ioc or fok, default is *market*
5713
+ * @param {string} [params.price] the price to fulfill the order, ignored in market orders
5714
+ * @param {string} [params.amount] the amount to trade in units of the base currency
5715
+ * @param {string} [params.clientOrderId] the client id of the order
5716
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5717
+ */
5718
+ await this.loadMarkets();
5719
+ const market = this.market(symbol);
5720
+ const type = this.safeString(params, 'type', 'market');
5721
+ const request = {
5722
+ 'market': market['id'],
5723
+ 'market_type': 'FUTURES',
5724
+ 'type': type,
5725
+ };
5726
+ const clientOrderId = this.safeString2(params, 'client_id', 'clientOrderId');
5727
+ if (clientOrderId !== undefined) {
5728
+ request['client_id'] = clientOrderId;
5729
+ }
5730
+ params = this.omit(params, 'clientOrderId');
5731
+ const response = await this.v2PrivatePostFuturesClosePosition(this.extend(request, params));
5732
+ //
5733
+ // {
5734
+ // "code": 0,
5735
+ // "data": {
5736
+ // "amount": "0.0001",
5737
+ // "client_id": "",
5738
+ // "created_at": 1729666043969,
5739
+ // "fee": "0.00335858",
5740
+ // "fee_ccy": "USDT",
5741
+ // "filled_amount": "0.0001",
5742
+ // "filled_value": "6.717179",
5743
+ // "last_filled_amount": "0.0001",
5744
+ // "last_filled_price": "67171.79",
5745
+ // "maker_fee_rate": "0",
5746
+ // "market": "BTCUSDT",
5747
+ // "market_type": "FUTURES",
5748
+ // "order_id": 155477479761,
5749
+ // "price": "0",
5750
+ // "realized_pnl": "-0.001823",
5751
+ // "side": "sell",
5752
+ // "taker_fee_rate": "0.0005",
5753
+ // "type": "market",
5754
+ // "unfilled_amount": "0",
5755
+ // "updated_at": 1729666043969
5756
+ // },
5757
+ // "message": "OK"
5758
+ // }
5759
+ //
5760
+ const data = this.safeDict(response, 'data', {});
5761
+ return this.parseOrder(data, market);
5762
+ }
5701
5763
  handleMarginModeAndParams(methodName, params = {}, defaultValue = undefined) {
5702
5764
  /**
5703
5765
  * @ignore
package/js/src/latoken.js CHANGED
@@ -49,6 +49,12 @@ export default class latoken extends Exchange {
49
49
  'fetchDepositAddressesByNetwork': false,
50
50
  'fetchDepositsWithdrawals': true,
51
51
  'fetchDepositWithdrawFees': false,
52
+ 'fetchFundingHistory': false,
53
+ 'fetchFundingInterval': false,
54
+ 'fetchFundingIntervals': false,
55
+ 'fetchFundingRate': false,
56
+ 'fetchFundingRateHistory': false,
57
+ 'fetchFundingRates': false,
52
58
  'fetchIsolatedBorrowRate': false,
53
59
  'fetchIsolatedBorrowRates': false,
54
60
  'fetchMarginMode': false,
package/js/src/mexc.js CHANGED
@@ -82,7 +82,7 @@ export default class mexc extends Exchange {
82
82
  'fetchFundingIntervals': false,
83
83
  'fetchFundingRate': true,
84
84
  'fetchFundingRateHistory': true,
85
- 'fetchFundingRates': undefined,
85
+ 'fetchFundingRates': false,
86
86
  'fetchIndexOHLCV': true,
87
87
  'fetchIsolatedBorrowRate': false,
88
88
  'fetchIsolatedBorrowRates': false,
package/js/src/oceanex.js CHANGED
@@ -53,6 +53,8 @@ export default class oceanex extends Exchange {
53
53
  'fetchDepositAddress': 'emulated',
54
54
  'fetchDepositAddresses': undefined,
55
55
  'fetchDepositAddressesByNetwork': true,
56
+ 'fetchFundingRateHistory': false,
57
+ 'fetchFundingRates': false,
56
58
  'fetchIsolatedBorrowRate': false,
57
59
  'fetchIsolatedBorrowRates': false,
58
60
  'fetchMarkets': true,
package/js/src/okcoin.js CHANGED
@@ -54,6 +54,7 @@ export default class okcoin extends Exchange {
54
54
  'fetchFundingHistory': false,
55
55
  'fetchFundingRate': false,
56
56
  'fetchFundingRateHistory': false,
57
+ 'fetchFundingRates': false,
57
58
  'fetchLedger': true,
58
59
  'fetchMarkets': true,
59
60
  'fetchMyTrades': true,
@@ -50,7 +50,12 @@ export default class poloniex extends Exchange {
50
50
  'fetchDepositsWithdrawals': true,
51
51
  'fetchDepositWithdrawFee': 'emulated',
52
52
  'fetchDepositWithdrawFees': true,
53
+ 'fetchFundingHistory': false,
54
+ 'fetchFundingInterval': false,
55
+ 'fetchFundingIntervals': false,
53
56
  'fetchFundingRate': false,
57
+ 'fetchFundingRateHistory': false,
58
+ 'fetchFundingRates': false,
54
59
  'fetchMarginMode': false,
55
60
  'fetchMarkets': true,
56
61
  'fetchMyTrades': true,
@@ -0,0 +1,57 @@
1
+ import coincatchRest from '../coincatch.js';
2
+ import type { Balances, Dict, Int, Market, OHLCV, Order, OrderBook, Position, Str, Strings, Ticker, Tickers, Trade } from '../base/types.js';
3
+ import Client from '../base/ws/Client.js';
4
+ export default class coincatch extends coincatchRest {
5
+ describe(): any;
6
+ getMarketFromArg(entry: any): import("../base/types.js").MarketInterface;
7
+ authenticate(params?: {}): Promise<any>;
8
+ watchPublic(messageHash: any, subscribeHash: any, args: any, params?: {}): Promise<any>;
9
+ unWatchPublic(messageHash: any, args: any, params?: {}): Promise<any>;
10
+ watchPrivate(messageHash: any, subscribeHash: any, args: any, params?: {}): Promise<any>;
11
+ watchPrivateMultiple(messageHashes: any, subscribeHashes: any, args: any, params?: {}): Promise<any>;
12
+ handleAuthenticate(client: Client, message: any): void;
13
+ watchPublicMultiple(messageHashes: any, subscribeHashes: any, argsArray: any, params?: {}): Promise<any>;
14
+ unWatchChannel(symbol: string, channel: string, messageHashTopic: string, params?: {}): Promise<any>;
15
+ getPublicInstTypeAndId(market: Market): any[];
16
+ handleDMCBLMarketByMessageHashes(market: Market, hash: string, client: Client, timeframe?: Str): import("../base/types.js").MarketInterface;
17
+ watchTicker(symbol: string, params?: {}): Promise<Ticker>;
18
+ unWatchTicker(symbol: string, params?: {}): Promise<any>;
19
+ watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
20
+ handleTicker(client: Client, message: any): void;
21
+ parseWsTicker(ticker: any, market?: any): Ticker;
22
+ watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
23
+ unWatchOHLCV(symbol: string, timeframe?: string, params?: {}): Promise<any>;
24
+ handleOHLCV(client: Client, message: any): void;
25
+ parseWsOHLCV(ohlcv: any, market?: Market): OHLCV;
26
+ watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
27
+ unWatchOrderBook(symbol: string, params?: {}): Promise<any>;
28
+ watchOrderBookForSymbols(symbols: string[], limit?: Int, params?: {}): Promise<OrderBook>;
29
+ handleOrderBook(client: Client, message: any): void;
30
+ handleCheckSumError(client: Client, symbol: string, messageHash: string): Promise<void>;
31
+ handleDelta(bookside: any, delta: any): void;
32
+ handleDeltas(bookside: any, deltas: any): void;
33
+ watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
34
+ watchTradesForSymbols(symbols: string[], since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
35
+ unWatchTrades(symbol: string, params?: {}): Promise<any>;
36
+ handleTrades(client: Client, message: any): void;
37
+ parseWsTrade(trade: any, market?: any): Trade;
38
+ watchBalance(params?: {}): Promise<Balances>;
39
+ handleBalance(client: Client, message: any): void;
40
+ watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
41
+ handleOrder(client: Client, message: any): void;
42
+ parseWsOrder(order: Dict, market?: Market): Order;
43
+ watchPositions(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
44
+ getPrivateInstType(market: Market): "umcbl" | "dmcbl";
45
+ handlePositions(client: Client, message: any): void;
46
+ parseWsPosition(position: any, market?: any): Position;
47
+ handleErrorMessage(client: Client, message: any): boolean;
48
+ handleMessage(client: Client, message: any): void;
49
+ ping(client: Client): string;
50
+ handlePong(client: Client, message: any): any;
51
+ handleSubscriptionStatus(client: Client, message: any): any;
52
+ handleUnSubscriptionStatus(client: Client, message: any): any;
53
+ handleOrderBookUnSubscription(client: Client, message: any): void;
54
+ handleTradesUnSubscription(client: Client, message: any): void;
55
+ handleTickerUnSubscription(client: Client, message: any): void;
56
+ handleOHLCVUnSubscription(client: Client, message: any): void;
57
+ }