ccxt 4.3.85 → 4.3.87
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.
- package/README.md +8 -5
- package/dist/ccxt.browser.min.js +15 -15
- package/dist/cjs/ccxt.js +7 -1
- package/dist/cjs/src/abstract/hashkey.js +9 -0
- package/dist/cjs/src/base/Exchange.js +1 -1
- package/dist/cjs/src/base/errors.js +8 -1
- package/dist/cjs/src/binance.js +4 -2
- package/dist/cjs/src/bingx.js +7 -1
- package/dist/cjs/src/bitfinex.js +2 -2
- package/dist/cjs/src/hashkey.js +4327 -0
- package/dist/cjs/src/hyperliquid.js +85 -65
- package/dist/cjs/src/indodax.js +37 -9
- package/dist/cjs/src/kraken.js +37 -6
- package/dist/cjs/src/krakenfutures.js +12 -10
- package/dist/cjs/src/pro/ascendex.js +45 -5
- package/dist/cjs/src/pro/bingx.js +13 -12
- package/dist/cjs/src/pro/bitget.js +164 -19
- package/dist/cjs/src/pro/hashkey.js +839 -0
- package/dist/cjs/src/pro/hyperliquid.js +123 -0
- package/dist/cjs/src/pro/mexc.js +13 -7
- package/dist/cjs/src/pro/p2b.js +34 -7
- package/dist/cjs/src/pro/poloniex.js +36 -3
- package/dist/cjs/src/pro/poloniexfutures.js +1 -0
- package/dist/cjs/src/pro/probit.js +2 -0
- package/dist/cjs/src/pro/upbit.js +48 -3
- package/dist/cjs/src/pro/vertex.js +1 -0
- package/dist/cjs/src/pro/wazirx.js +3 -0
- package/dist/cjs/src/pro/whitebit.js +9 -0
- package/dist/cjs/src/pro/woo.js +1 -0
- package/dist/cjs/src/pro/woofipro.js +1 -0
- package/dist/cjs/src/pro/xt.js +1 -0
- package/dist/cjs/src/upbit.js +1 -1
- package/js/ccxt.d.ts +9 -3
- package/js/ccxt.js +7 -3
- package/js/src/abstract/hashkey.d.ts +70 -0
- package/js/src/abstract/hashkey.js +11 -0
- package/js/src/base/Exchange.js +1 -1
- package/js/src/base/errorHierarchy.d.ts +1 -0
- package/js/src/base/errorHierarchy.js +1 -0
- package/js/src/base/errors.d.ts +5 -1
- package/js/src/base/errors.js +8 -2
- package/js/src/binance.js +4 -2
- package/js/src/bingx.js +7 -1
- package/js/src/bitfinex.js +2 -2
- package/js/src/hashkey.d.ts +178 -0
- package/js/src/hashkey.js +4328 -0
- package/js/src/hyperliquid.d.ts +3 -0
- package/js/src/hyperliquid.js +85 -65
- package/js/src/indodax.js +37 -9
- package/js/src/kraken.js +37 -6
- package/js/src/krakenfutures.js +12 -10
- package/js/src/pro/ascendex.d.ts +2 -0
- package/js/src/pro/ascendex.js +45 -5
- package/js/src/pro/bingx.js +13 -12
- package/js/src/pro/bitget.d.ts +8 -0
- package/js/src/pro/bitget.js +165 -20
- package/js/src/pro/hashkey.d.ts +34 -0
- package/js/src/pro/hashkey.js +840 -0
- package/js/src/pro/hyperliquid.d.ts +7 -1
- package/js/src/pro/hyperliquid.js +123 -0
- package/js/src/pro/mexc.js +13 -7
- package/js/src/pro/p2b.d.ts +1 -0
- package/js/src/pro/p2b.js +34 -7
- package/js/src/pro/poloniex.d.ts +1 -0
- package/js/src/pro/poloniex.js +36 -3
- package/js/src/pro/poloniexfutures.js +1 -0
- package/js/src/pro/probit.js +2 -0
- package/js/src/pro/upbit.d.ts +1 -0
- package/js/src/pro/upbit.js +48 -3
- package/js/src/pro/vertex.js +1 -0
- package/js/src/pro/wazirx.js +3 -0
- package/js/src/pro/whitebit.js +9 -0
- package/js/src/pro/woo.js +1 -0
- package/js/src/pro/woofipro.js +1 -0
- package/js/src/pro/xt.js +1 -0
- package/js/src/upbit.js +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,9 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
11
11
|
return this.deepExtend(super.describe(), {
|
|
12
12
|
'has': {
|
|
13
13
|
'ws': true,
|
|
14
|
+
'createOrderWs': true,
|
|
15
|
+
'createOrdersWs': true,
|
|
16
|
+
'editOrderWs': true,
|
|
14
17
|
'watchBalance': false,
|
|
15
18
|
'watchMyTrades': true,
|
|
16
19
|
'watchOHLCV': true,
|
|
@@ -45,6 +48,90 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
45
48
|
},
|
|
46
49
|
});
|
|
47
50
|
}
|
|
51
|
+
async createOrdersWs(orders, params = {}) {
|
|
52
|
+
/**
|
|
53
|
+
* @method
|
|
54
|
+
* @name hyperliquid#createOrdersWs
|
|
55
|
+
* @description create a list of trade orders using WebSocket post request
|
|
56
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
|
|
57
|
+
* @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
|
58
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
59
|
+
*/
|
|
60
|
+
await this.loadMarkets();
|
|
61
|
+
const url = this.urls['api']['ws']['public'];
|
|
62
|
+
const ordersRequest = this.createOrdersRequest(orders, params);
|
|
63
|
+
const wrapped = this.wrapAsPostAction(ordersRequest);
|
|
64
|
+
const request = this.safeDict(wrapped, 'request', {});
|
|
65
|
+
const requestId = this.safeString(wrapped, 'requestId');
|
|
66
|
+
const response = await this.watch(url, requestId, request, requestId);
|
|
67
|
+
const responseOjb = this.safeDict(response, 'response', {});
|
|
68
|
+
const data = this.safeDict(responseOjb, 'data', {});
|
|
69
|
+
const statuses = this.safeList(data, 'statuses', []);
|
|
70
|
+
return this.parseOrders(statuses, undefined);
|
|
71
|
+
}
|
|
72
|
+
async createOrderWs(symbol, type, side, amount, price = undefined, params = {}) {
|
|
73
|
+
/**
|
|
74
|
+
* @method
|
|
75
|
+
* @name hyperliquid#createOrder
|
|
76
|
+
* @description create a trade order using WebSocket post request
|
|
77
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
|
|
78
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
79
|
+
* @param {string} type 'market' or 'limit'
|
|
80
|
+
* @param {string} side 'buy' or 'sell'
|
|
81
|
+
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
82
|
+
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
83
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
84
|
+
* @param {string} [params.timeInForce] 'Gtc', 'Ioc', 'Alo'
|
|
85
|
+
* @param {bool} [params.postOnly] true or false whether the order is post-only
|
|
86
|
+
* @param {bool} [params.reduceOnly] true or false whether the order is reduce-only
|
|
87
|
+
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
88
|
+
* @param {string} [params.clientOrderId] client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
|
|
89
|
+
* @param {string} [params.slippage] the slippage for market order
|
|
90
|
+
* @param {string} [params.vaultAddress] the vault address for order
|
|
91
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
92
|
+
*/
|
|
93
|
+
await this.loadMarkets();
|
|
94
|
+
const [order, globalParams] = this.parseCreateOrderArgs(symbol, type, side, amount, price, params);
|
|
95
|
+
const orders = await this.createOrdersWs([order], globalParams);
|
|
96
|
+
return orders[0];
|
|
97
|
+
}
|
|
98
|
+
async editOrderWs(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
99
|
+
/**
|
|
100
|
+
* @method
|
|
101
|
+
* @name hyperliquid#editOrder
|
|
102
|
+
* @description edit a trade order
|
|
103
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
|
|
104
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
|
105
|
+
* @param {string} id cancel order id
|
|
106
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
107
|
+
* @param {string} type 'market' or 'limit'
|
|
108
|
+
* @param {string} side 'buy' or 'sell'
|
|
109
|
+
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
110
|
+
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
111
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
112
|
+
* @param {string} [params.timeInForce] 'Gtc', 'Ioc', 'Alo'
|
|
113
|
+
* @param {bool} [params.postOnly] true or false whether the order is post-only
|
|
114
|
+
* @param {bool} [params.reduceOnly] true or false whether the order is reduce-only
|
|
115
|
+
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
116
|
+
* @param {string} [params.clientOrderId] client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
|
|
117
|
+
* @param {string} [params.vaultAddress] the vault address for order
|
|
118
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
119
|
+
*/
|
|
120
|
+
await this.loadMarkets();
|
|
121
|
+
const market = this.market(symbol);
|
|
122
|
+
const url = this.urls['api']['ws']['public'];
|
|
123
|
+
const postRequest = this.editOrderRequest(id, symbol, type, side, amount, price, params);
|
|
124
|
+
const wrapped = this.wrapAsPostAction(postRequest);
|
|
125
|
+
const request = this.safeDict(wrapped, 'request', {});
|
|
126
|
+
const requestId = this.safeString(wrapped, 'requestId');
|
|
127
|
+
const response = await this.watch(url, requestId, request, requestId);
|
|
128
|
+
// response is the same as in this.editOrder
|
|
129
|
+
const responseObject = this.safeDict(response, 'response', {});
|
|
130
|
+
const dataObject = this.safeDict(responseObject, 'data', {});
|
|
131
|
+
const statuses = this.safeList(dataObject, 'statuses', []);
|
|
132
|
+
const first = this.safeDict(statuses, 0, {});
|
|
133
|
+
return this.parseOrder(first, market);
|
|
134
|
+
}
|
|
48
135
|
async watchOrderBook(symbol, limit = undefined, params = {}) {
|
|
49
136
|
/**
|
|
50
137
|
* @method
|
|
@@ -510,6 +597,22 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
510
597
|
const messageHash = 'candles:' + timeframe + ':' + symbol;
|
|
511
598
|
client.resolve(ohlcv, messageHash);
|
|
512
599
|
}
|
|
600
|
+
handleWsPost(client, message) {
|
|
601
|
+
// {
|
|
602
|
+
// channel: "post",
|
|
603
|
+
// data: {
|
|
604
|
+
// id: <number>,
|
|
605
|
+
// response: {
|
|
606
|
+
// type: "info" | "action" | "error",
|
|
607
|
+
// payload: { ... }
|
|
608
|
+
// }
|
|
609
|
+
// }
|
|
610
|
+
const data = this.safeDict(message, 'data');
|
|
611
|
+
const id = this.safeString(data, 'id');
|
|
612
|
+
const response = this.safeDict(data, 'response');
|
|
613
|
+
const payload = this.safeDict(response, 'payload');
|
|
614
|
+
client.resolve(payload, id);
|
|
615
|
+
}
|
|
513
616
|
async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
514
617
|
/**
|
|
515
618
|
* @method
|
|
@@ -624,6 +727,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
624
727
|
'orderUpdates': this.handleOrder,
|
|
625
728
|
'userFills': this.handleMyTrades,
|
|
626
729
|
'webData2': this.handleWsTickers,
|
|
730
|
+
'post': this.handleWsPost,
|
|
627
731
|
};
|
|
628
732
|
const exacMethod = this.safeValue(methods, topic);
|
|
629
733
|
if (exacMethod !== undefined) {
|
|
@@ -654,6 +758,25 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
654
758
|
client.lastPong = this.safeInteger(message, 'pong');
|
|
655
759
|
return message;
|
|
656
760
|
}
|
|
761
|
+
requestId() {
|
|
762
|
+
const requestId = this.sum(this.safeInteger(this.options, 'requestId', 0), 1);
|
|
763
|
+
this.options['requestId'] = requestId;
|
|
764
|
+
return requestId;
|
|
765
|
+
}
|
|
766
|
+
wrapAsPostAction(request) {
|
|
767
|
+
const requestId = this.requestId();
|
|
768
|
+
return {
|
|
769
|
+
'requestId': requestId,
|
|
770
|
+
'request': {
|
|
771
|
+
'method': 'post',
|
|
772
|
+
'id': requestId,
|
|
773
|
+
'request': {
|
|
774
|
+
'type': 'action',
|
|
775
|
+
'payload': request,
|
|
776
|
+
},
|
|
777
|
+
},
|
|
778
|
+
};
|
|
779
|
+
}
|
|
657
780
|
}
|
|
658
781
|
|
|
659
782
|
module.exports = hyperliquid;
|
package/dist/cjs/src/pro/mexc.js
CHANGED
|
@@ -29,6 +29,7 @@ class mexc extends mexc$1 {
|
|
|
29
29
|
'watchTicker': true,
|
|
30
30
|
'watchTickers': false,
|
|
31
31
|
'watchTrades': true,
|
|
32
|
+
'watchTradesForSymbols': false,
|
|
32
33
|
},
|
|
33
34
|
'urls': {
|
|
34
35
|
'api': {
|
|
@@ -71,6 +72,8 @@ class mexc extends mexc$1 {
|
|
|
71
72
|
* @method
|
|
72
73
|
* @name mexc#watchTicker
|
|
73
74
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
75
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#individual-symbol-book-ticker-streams
|
|
76
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#public-channels
|
|
74
77
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
75
78
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
76
79
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -203,7 +206,7 @@ class mexc extends mexc$1 {
|
|
|
203
206
|
/**
|
|
204
207
|
* @method
|
|
205
208
|
* @name mexc#watchOHLCV
|
|
206
|
-
* @see https://
|
|
209
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#kline-streams
|
|
207
210
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
208
211
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
209
212
|
* @param {string} timeframe the length of time each candle represents
|
|
@@ -349,7 +352,8 @@ class mexc extends mexc$1 {
|
|
|
349
352
|
/**
|
|
350
353
|
* @method
|
|
351
354
|
* @name mexc#watchOrderBook
|
|
352
|
-
* @see https://
|
|
355
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#diff-depth-stream
|
|
356
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#public-channels
|
|
353
357
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
354
358
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
355
359
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
@@ -519,7 +523,8 @@ class mexc extends mexc$1 {
|
|
|
519
523
|
/**
|
|
520
524
|
* @method
|
|
521
525
|
* @name mexc#watchTrades
|
|
522
|
-
* @see https://
|
|
526
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#trade-streams
|
|
527
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#public-channels
|
|
523
528
|
* @description get the list of most recent trades for a particular symbol
|
|
524
529
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
525
530
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
@@ -608,7 +613,8 @@ class mexc extends mexc$1 {
|
|
|
608
613
|
/**
|
|
609
614
|
* @method
|
|
610
615
|
* @name mexc#watchMyTrades
|
|
611
|
-
* @see https://
|
|
616
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#spot-account-deals
|
|
617
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#private-channels
|
|
612
618
|
* @description watches information on multiple trades made by the user
|
|
613
619
|
* @param {string} symbol unified market symbol of the market trades were made in
|
|
614
620
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
@@ -755,8 +761,8 @@ class mexc extends mexc$1 {
|
|
|
755
761
|
/**
|
|
756
762
|
* @method
|
|
757
763
|
* @name mexc#watchOrders
|
|
758
|
-
* @see https://
|
|
759
|
-
* @see https://
|
|
764
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#spot-account-orders
|
|
765
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#margin-account-orders
|
|
760
766
|
* @description watches information on multiple orders made by the user
|
|
761
767
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
762
768
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -1007,7 +1013,7 @@ class mexc extends mexc$1 {
|
|
|
1007
1013
|
/**
|
|
1008
1014
|
* @method
|
|
1009
1015
|
* @name mexc#watchBalance
|
|
1010
|
-
* @see https://
|
|
1016
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#spot-account-upadte
|
|
1011
1017
|
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
1012
1018
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1013
1019
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
package/dist/cjs/src/pro/p2b.js
CHANGED
|
@@ -29,6 +29,7 @@ class p2b extends p2b$1 {
|
|
|
29
29
|
'watchTicker': true,
|
|
30
30
|
'watchTickers': false,
|
|
31
31
|
'watchTrades': true,
|
|
32
|
+
'watchTradesForSymbols': true,
|
|
32
33
|
},
|
|
33
34
|
'urls': {
|
|
34
35
|
'api': {
|
|
@@ -144,15 +145,41 @@ class p2b extends p2b$1 {
|
|
|
144
145
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
145
146
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
146
147
|
*/
|
|
148
|
+
return await this.watchTradesForSymbols([symbol], since, limit, params);
|
|
149
|
+
}
|
|
150
|
+
async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
151
|
+
/**
|
|
152
|
+
* @method
|
|
153
|
+
* @name p2b#watchTradesForSymbols
|
|
154
|
+
* @description get the list of most recent trades for a list of symbols
|
|
155
|
+
* @see https://github.com/P2B-team/P2B-WSS-Public/blob/main/wss_documentation.md#deals
|
|
156
|
+
* @param {string[]} symbols unified symbol of the market to fetch trades for
|
|
157
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
158
|
+
* @param {int} [limit] the maximum amount of trades to fetch
|
|
159
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
160
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
161
|
+
*/
|
|
147
162
|
await this.loadMarkets();
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
163
|
+
symbols = this.marketSymbols(symbols, undefined, false, true, true);
|
|
164
|
+
const messageHashes = [];
|
|
165
|
+
if (symbols !== undefined) {
|
|
166
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
167
|
+
messageHashes.push('deals::' + symbols[i]);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const marketIds = this.marketIds(symbols);
|
|
171
|
+
const url = this.urls['api']['ws'];
|
|
172
|
+
const subscribe = {
|
|
173
|
+
'method': 'deals.subscribe',
|
|
174
|
+
'params': marketIds,
|
|
175
|
+
'id': this.milliseconds(),
|
|
176
|
+
};
|
|
177
|
+
const query = this.extend(subscribe, params);
|
|
178
|
+
const trades = await this.watchMultiple(url, messageHashes, query, messageHashes);
|
|
154
179
|
if (this.newUpdates) {
|
|
155
|
-
|
|
180
|
+
const first = this.safeValue(trades, 0);
|
|
181
|
+
const tradeSymbol = this.safeString(first, 'symbol');
|
|
182
|
+
limit = trades.getLimit(tradeSymbol, limit);
|
|
156
183
|
}
|
|
157
184
|
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
158
185
|
}
|
|
@@ -18,6 +18,7 @@ class poloniex extends poloniex$1 {
|
|
|
18
18
|
'watchTicker': true,
|
|
19
19
|
'watchTickers': true,
|
|
20
20
|
'watchTrades': true,
|
|
21
|
+
'watchTradesForSymbols': true,
|
|
21
22
|
'watchBalance': true,
|
|
22
23
|
'watchStatus': false,
|
|
23
24
|
'watchOrders': true,
|
|
@@ -395,12 +396,44 @@ class poloniex extends poloniex$1 {
|
|
|
395
396
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
396
397
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
397
398
|
*/
|
|
399
|
+
return await this.watchTradesForSymbols([symbol], since, limit, params);
|
|
400
|
+
}
|
|
401
|
+
async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
402
|
+
/**
|
|
403
|
+
* @method
|
|
404
|
+
* @name poloniex#watchTradesForSymbols
|
|
405
|
+
* @description get the list of most recent trades for a list of symbols
|
|
406
|
+
* @see https://api-docs.poloniex.com/spot/websocket/market-data#trades
|
|
407
|
+
* @param {string[]} symbols unified symbol of the market to fetch trades for
|
|
408
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
409
|
+
* @param {int} [limit] the maximum amount of trades to fetch
|
|
410
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
411
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
412
|
+
*/
|
|
398
413
|
await this.loadMarkets();
|
|
399
|
-
|
|
414
|
+
symbols = this.marketSymbols(symbols, undefined, false, true, true);
|
|
400
415
|
const name = 'trades';
|
|
401
|
-
const
|
|
416
|
+
const url = this.urls['api']['ws']['public'];
|
|
417
|
+
const marketIds = this.marketIds(symbols);
|
|
418
|
+
const subscribe = {
|
|
419
|
+
'event': 'subscribe',
|
|
420
|
+
'channel': [
|
|
421
|
+
name,
|
|
422
|
+
],
|
|
423
|
+
'symbols': marketIds,
|
|
424
|
+
};
|
|
425
|
+
const request = this.extend(subscribe, params);
|
|
426
|
+
const messageHashes = [];
|
|
427
|
+
if (symbols !== undefined) {
|
|
428
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
429
|
+
messageHashes.push(name + '::' + symbols[i]);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
const trades = await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
402
433
|
if (this.newUpdates) {
|
|
403
|
-
|
|
434
|
+
const first = this.safeValue(trades, 0);
|
|
435
|
+
const tradeSymbol = this.safeString(first, 'symbol');
|
|
436
|
+
limit = trades.getLimit(tradeSymbol, limit);
|
|
404
437
|
}
|
|
405
438
|
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
406
439
|
}
|
|
@@ -15,6 +15,7 @@ class probit extends probit$1 {
|
|
|
15
15
|
'watchTicker': true,
|
|
16
16
|
'watchTickers': false,
|
|
17
17
|
'watchTrades': true,
|
|
18
|
+
'watchTradesForSymbols': false,
|
|
18
19
|
'watchMyTrades': true,
|
|
19
20
|
'watchOrders': true,
|
|
20
21
|
'watchOrderBook': true,
|
|
@@ -222,6 +223,7 @@ class probit extends probit$1 {
|
|
|
222
223
|
* @method
|
|
223
224
|
* @name probit#watchMyTrades
|
|
224
225
|
* @description get the list of trades associated with the user
|
|
226
|
+
* @see https://docs-en.probit.com/reference/trade_history
|
|
225
227
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
226
228
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
227
229
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -15,6 +15,7 @@ class upbit extends upbit$1 {
|
|
|
15
15
|
'watchOrderBook': true,
|
|
16
16
|
'watchTicker': true,
|
|
17
17
|
'watchTrades': true,
|
|
18
|
+
'watchTradesForSymbols': true,
|
|
18
19
|
'watchOrders': true,
|
|
19
20
|
'watchMyTrades': true,
|
|
20
21
|
'watchBalance': true,
|
|
@@ -79,11 +80,55 @@ class upbit extends upbit$1 {
|
|
|
79
80
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
80
81
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
81
82
|
*/
|
|
83
|
+
return await this.watchTradesForSymbols([symbol], since, limit, params);
|
|
84
|
+
}
|
|
85
|
+
async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
86
|
+
/**
|
|
87
|
+
* @method
|
|
88
|
+
* @name upbit#watchTradesForSymbols
|
|
89
|
+
* @description get the list of most recent trades for a list of symbols
|
|
90
|
+
* @see https://global-docs.upbit.com/reference/websocket-trade
|
|
91
|
+
* @param {string[]} symbols unified symbol of the market to fetch trades for
|
|
92
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
93
|
+
* @param {int} [limit] the maximum amount of trades to fetch
|
|
94
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
95
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
96
|
+
*/
|
|
82
97
|
await this.loadMarkets();
|
|
83
|
-
|
|
84
|
-
const
|
|
98
|
+
symbols = this.marketSymbols(symbols, undefined, false, true, true);
|
|
99
|
+
const channel = 'trade';
|
|
100
|
+
const messageHashes = [];
|
|
101
|
+
const url = this.implodeParams(this.urls['api']['ws'], {
|
|
102
|
+
'hostname': this.hostname,
|
|
103
|
+
});
|
|
104
|
+
if (symbols !== undefined) {
|
|
105
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
106
|
+
const market = this.market(symbols[i]);
|
|
107
|
+
const marketId = market['id'];
|
|
108
|
+
const symbol = market['symbol'];
|
|
109
|
+
this.options[channel] = this.safeValue(this.options, channel, {});
|
|
110
|
+
this.options[channel][symbol] = true;
|
|
111
|
+
messageHashes.push(channel + ':' + marketId);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const optionSymbols = Object.keys(this.options[channel]);
|
|
115
|
+
const marketIds = this.marketIds(optionSymbols);
|
|
116
|
+
const request = [
|
|
117
|
+
{
|
|
118
|
+
'ticket': this.uuid(),
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
'type': channel,
|
|
122
|
+
'codes': marketIds,
|
|
123
|
+
// 'isOnlySnapshot': false,
|
|
124
|
+
// 'isOnlyRealtime': false,
|
|
125
|
+
},
|
|
126
|
+
];
|
|
127
|
+
const trades = await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
85
128
|
if (this.newUpdates) {
|
|
86
|
-
|
|
129
|
+
const first = this.safeValue(trades, 0);
|
|
130
|
+
const tradeSymbol = this.safeString(first, 'symbol');
|
|
131
|
+
limit = trades.getLimit(tradeSymbol, limit);
|
|
87
132
|
}
|
|
88
133
|
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
89
134
|
}
|
|
@@ -15,6 +15,7 @@ class wazirx extends wazirx$1 {
|
|
|
15
15
|
'watchTicker': true,
|
|
16
16
|
'watchTickers': true,
|
|
17
17
|
'watchTrades': true,
|
|
18
|
+
'watchTradesForSymbols': false,
|
|
18
19
|
'watchMyTrades': true,
|
|
19
20
|
'watchOrders': true,
|
|
20
21
|
'watchOrderBook': true,
|
|
@@ -284,6 +285,7 @@ class wazirx extends wazirx$1 {
|
|
|
284
285
|
* @method
|
|
285
286
|
* @name wazirx#watchTrades
|
|
286
287
|
* @description get the list of most recent trades for a particular symbol
|
|
288
|
+
* @see https://docs.wazirx.com/#trade-streams
|
|
287
289
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
288
290
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
289
291
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -381,6 +383,7 @@ class wazirx extends wazirx$1 {
|
|
|
381
383
|
* @method
|
|
382
384
|
* @name wazirx#watchOHLCV
|
|
383
385
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
386
|
+
* @see https://docs.wazirx.com/#kline-candlestick-stream
|
|
384
387
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
385
388
|
* @param {string} timeframe the length of time each candle represents
|
|
386
389
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -19,6 +19,7 @@ class whitebit extends whitebit$1 {
|
|
|
19
19
|
'watchOrders': true,
|
|
20
20
|
'watchTicker': true,
|
|
21
21
|
'watchTrades': true,
|
|
22
|
+
'watchTradesForSymbols': false,
|
|
22
23
|
},
|
|
23
24
|
'urls': {
|
|
24
25
|
'api': {
|
|
@@ -61,6 +62,7 @@ class whitebit extends whitebit$1 {
|
|
|
61
62
|
* @method
|
|
62
63
|
* @name whitebit#watchOHLCV
|
|
63
64
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
65
|
+
* @see https://docs.whitebit.com/public/websocket/#kline
|
|
64
66
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
65
67
|
* @param {string} timeframe the length of time each candle represents
|
|
66
68
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -135,6 +137,7 @@ class whitebit extends whitebit$1 {
|
|
|
135
137
|
* @method
|
|
136
138
|
* @name whitebit#watchOrderBook
|
|
137
139
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
140
|
+
* @see https://docs.whitebit.com/public/websocket/#market-depth
|
|
138
141
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
139
142
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
140
143
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -240,6 +243,7 @@ class whitebit extends whitebit$1 {
|
|
|
240
243
|
* @method
|
|
241
244
|
* @name whitebit#watchTicker
|
|
242
245
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
246
|
+
* @see https://docs.whitebit.com/public/websocket/#market-statistics
|
|
243
247
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
244
248
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
245
249
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -306,6 +310,7 @@ class whitebit extends whitebit$1 {
|
|
|
306
310
|
* @method
|
|
307
311
|
* @name whitebit#watchTrades
|
|
308
312
|
* @description get the list of most recent trades for a particular symbol
|
|
313
|
+
* @see https://docs.whitebit.com/public/websocket/#market-trades
|
|
309
314
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
310
315
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
311
316
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -372,6 +377,7 @@ class whitebit extends whitebit$1 {
|
|
|
372
377
|
* @method
|
|
373
378
|
* @name whitebit#watchMyTrades
|
|
374
379
|
* @description watches trades made by the user
|
|
380
|
+
* @see https://docs.whitebit.com/private/websocket/#deals
|
|
375
381
|
* @param {str} symbol unified market symbol
|
|
376
382
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
377
383
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -471,6 +477,7 @@ class whitebit extends whitebit$1 {
|
|
|
471
477
|
* @method
|
|
472
478
|
* @name whitebit#watchOrders
|
|
473
479
|
* @description watches information on multiple orders made by the user
|
|
480
|
+
* @see https://docs.whitebit.com/private/websocket/#orders-pending
|
|
474
481
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
475
482
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
476
483
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -646,6 +653,8 @@ class whitebit extends whitebit$1 {
|
|
|
646
653
|
* @method
|
|
647
654
|
* @name whitebit#watchBalance
|
|
648
655
|
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
656
|
+
* @see https://docs.whitebit.com/private/websocket/#balance-spot
|
|
657
|
+
* @see https://docs.whitebit.com/private/websocket/#balance-margin
|
|
649
658
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
650
659
|
* @param {str} [params.type] spot or contract if not provided this.options['defaultType'] is used
|
|
651
660
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
package/dist/cjs/src/pro/woo.js
CHANGED
package/dist/cjs/src/pro/xt.js
CHANGED
package/dist/cjs/src/upbit.js
CHANGED
|
@@ -2001,7 +2001,7 @@ class upbit extends upbit$1 {
|
|
|
2001
2001
|
headers['Content-Type'] = 'application/json';
|
|
2002
2002
|
}
|
|
2003
2003
|
if (hasQuery) {
|
|
2004
|
-
auth = this.
|
|
2004
|
+
auth = this.rawencode(query);
|
|
2005
2005
|
}
|
|
2006
2006
|
if (auth !== undefined) {
|
|
2007
2007
|
const hash = this.hash(this.encode(auth), sha512.sha512);
|