ccxt 4.4.33 → 4.4.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.
- package/README.md +8 -7
- package/dist/ccxt.browser.min.js +6 -6
- package/dist/cjs/ccxt.js +4 -1
- package/dist/cjs/src/abstract/ellipx.js +9 -0
- package/dist/cjs/src/alpaca.js +2 -0
- package/dist/cjs/src/base/Exchange.js +32 -6
- package/dist/cjs/src/binance.js +19 -14
- package/dist/cjs/src/bingx.js +495 -153
- package/dist/cjs/src/bitbank.js +5 -0
- package/dist/cjs/src/bitbns.js +2 -0
- package/dist/cjs/src/bitfinex2.js +2 -1
- package/dist/cjs/src/bitget.js +177 -44
- package/dist/cjs/src/bitmex.js +3 -1
- package/dist/cjs/src/bitopro.js +3 -0
- package/dist/cjs/src/bitrue.js +3 -2
- package/dist/cjs/src/btcmarkets.js +5 -3
- package/dist/cjs/src/btcturk.js +19 -19
- package/dist/cjs/src/bybit.js +14 -11
- package/dist/cjs/src/cex.js +13 -4
- package/dist/cjs/src/coinbase.js +3 -2
- package/dist/cjs/src/coinex.js +1 -0
- package/dist/cjs/src/coinone.js +7 -7
- package/dist/cjs/src/coinsph.js +7 -7
- package/dist/cjs/src/coinspot.js +39 -39
- package/dist/cjs/src/cryptocom.js +36 -34
- package/dist/cjs/src/ellipx.js +1871 -0
- package/dist/cjs/src/gate.js +145 -41
- package/dist/cjs/src/hyperliquid.js +75 -11
- package/dist/cjs/src/idex.js +3 -3
- package/dist/cjs/src/kraken.js +71 -54
- package/dist/cjs/src/krakenfutures.js +3 -1
- package/dist/cjs/src/kucoin.js +1 -1
- package/dist/cjs/src/okcoin.js +2 -0
- package/dist/cjs/src/okx.js +16 -11
- package/dist/cjs/src/onetrading.js +34 -396
- package/dist/cjs/src/paradex.js +2 -0
- package/dist/cjs/src/phemex.js +23 -0
- package/dist/cjs/src/poloniex.js +3 -1
- package/dist/cjs/src/poloniexfutures.js +3 -1
- package/dist/cjs/src/pro/bitrue.js +13 -11
- package/dist/cjs/src/pro/idex.js +5 -0
- package/dist/cjs/src/pro/probit.js +62 -68
- package/dist/cjs/src/pro/woo.js +15 -15
- package/dist/cjs/src/vertex.js +2 -0
- package/dist/cjs/src/woo.js +69 -69
- package/dist/cjs/src/xt.js +5 -5
- package/examples/js/cli.js +1 -1
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- package/js/src/abstract/bingx.d.ts +17 -0
- package/js/src/abstract/bitbank.d.ts +5 -0
- package/js/src/abstract/bitfinex2.d.ts +1 -0
- package/js/src/abstract/bitpanda.d.ts +0 -12
- package/js/src/abstract/bitrue.d.ts +3 -3
- package/js/src/abstract/ellipx.d.ts +28 -0
- package/js/src/abstract/ellipx.js +11 -0
- package/js/src/abstract/okx.d.ts +1 -0
- package/js/src/abstract/onetrading.d.ts +0 -12
- package/js/src/alpaca.js +2 -0
- package/js/src/base/Exchange.d.ts +8 -0
- package/js/src/base/Exchange.js +32 -6
- package/js/src/binance.js +19 -14
- package/js/src/bingx.d.ts +11 -1
- package/js/src/bingx.js +495 -153
- package/js/src/bitbank.js +5 -0
- package/js/src/bitbns.js +2 -0
- package/js/src/bitfinex2.js +2 -1
- package/js/src/bitget.d.ts +4 -4
- package/js/src/bitget.js +177 -44
- package/js/src/bitmex.js +3 -1
- package/js/src/bitopro.d.ts +1 -0
- package/js/src/bitopro.js +3 -0
- package/js/src/bitrue.js +3 -2
- package/js/src/btcmarkets.d.ts +1 -0
- package/js/src/btcmarkets.js +5 -3
- package/js/src/btcturk.js +19 -19
- package/js/src/bybit.d.ts +3 -2
- package/js/src/bybit.js +14 -11
- package/js/src/cex.d.ts +1 -0
- package/js/src/cex.js +13 -4
- package/js/src/coinbase.d.ts +2 -1
- package/js/src/coinbase.js +3 -2
- package/js/src/coinex.js +1 -0
- package/js/src/coinone.js +7 -7
- package/js/src/coinsph.js +7 -7
- package/js/src/coinspot.js +39 -39
- package/js/src/cryptocom.d.ts +1 -1
- package/js/src/cryptocom.js +36 -34
- package/js/src/ellipx.d.ts +236 -0
- package/js/src/ellipx.js +1874 -0
- package/js/src/gate.d.ts +7 -7
- package/js/src/gate.js +145 -41
- package/js/src/hyperliquid.d.ts +10 -0
- package/js/src/hyperliquid.js +77 -13
- package/js/src/idex.js +4 -4
- package/js/src/kraken.d.ts +11 -8
- package/js/src/kraken.js +71 -54
- package/js/src/krakenfutures.js +3 -1
- package/js/src/kucoin.js +1 -1
- package/js/src/okcoin.js +2 -0
- package/js/src/okx.d.ts +1 -1
- package/js/src/okx.js +16 -11
- package/js/src/onetrading.d.ts +20 -67
- package/js/src/onetrading.js +35 -397
- package/js/src/paradex.js +2 -0
- package/js/src/phemex.js +23 -0
- package/js/src/poloniex.d.ts +1 -1
- package/js/src/poloniex.js +3 -1
- package/js/src/poloniexfutures.d.ts +1 -1
- package/js/src/poloniexfutures.js +3 -1
- package/js/src/pro/bitrue.js +13 -11
- package/js/src/pro/idex.d.ts +5 -0
- package/js/src/pro/idex.js +5 -0
- package/js/src/pro/probit.d.ts +2 -1
- package/js/src/pro/probit.js +62 -68
- package/js/src/pro/woo.d.ts +11 -11
- package/js/src/pro/woo.js +15 -15
- package/js/src/vertex.js +2 -0
- package/js/src/woo.d.ts +60 -60
- package/js/src/woo.js +69 -69
- package/js/src/xt.js +5 -5
- package/package.json +4 -3
package/js/src/poloniex.d.ts
CHANGED
|
@@ -129,7 +129,7 @@ export default class poloniex extends Exchange {
|
|
|
129
129
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
130
130
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
131
131
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
132
|
-
* @param {float} [params.triggerPrice]
|
|
132
|
+
* @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
133
133
|
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
134
134
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
135
135
|
*/
|
package/js/src/poloniex.js
CHANGED
|
@@ -39,6 +39,8 @@ export default class poloniex extends Exchange {
|
|
|
39
39
|
'createMarketOrderWithCost': false,
|
|
40
40
|
'createMarketSellOrderWithCost': false,
|
|
41
41
|
'createOrder': true,
|
|
42
|
+
'createStopOrder': true,
|
|
43
|
+
'createTriggerOrder': true,
|
|
42
44
|
'editOrder': true,
|
|
43
45
|
'fetchBalance': true,
|
|
44
46
|
'fetchClosedOrder': false,
|
|
@@ -1269,7 +1271,7 @@ export default class poloniex extends Exchange {
|
|
|
1269
1271
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
1270
1272
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
1271
1273
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1272
|
-
* @param {float} [params.triggerPrice]
|
|
1274
|
+
* @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
1273
1275
|
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
1274
1276
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1275
1277
|
*/
|
|
@@ -117,7 +117,7 @@ export default class poloniexfutures extends Exchange {
|
|
|
117
117
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
118
118
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
119
119
|
* @param {float} [params.leverage] Leverage size of the order
|
|
120
|
-
* @param {float} [params.
|
|
120
|
+
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
121
121
|
* @param {bool} [params.reduceOnly] A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true.
|
|
122
122
|
* @param {string} [params.timeInForce] GTC, GTT, IOC, or FOK, default is GTC, limit orders only
|
|
123
123
|
* @param {string} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK
|
|
@@ -34,6 +34,8 @@ export default class poloniexfutures extends Exchange {
|
|
|
34
34
|
'future': false,
|
|
35
35
|
'option': undefined,
|
|
36
36
|
'createOrder': true,
|
|
37
|
+
'createStopOrder': true,
|
|
38
|
+
'createTriggerOrder': true,
|
|
37
39
|
'fetchBalance': true,
|
|
38
40
|
'fetchClosedOrders': true,
|
|
39
41
|
'fetchCurrencies': false,
|
|
@@ -838,7 +840,7 @@ export default class poloniexfutures extends Exchange {
|
|
|
838
840
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
839
841
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
840
842
|
* @param {float} [params.leverage] Leverage size of the order
|
|
841
|
-
* @param {float} [params.
|
|
843
|
+
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
842
844
|
* @param {bool} [params.reduceOnly] A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true.
|
|
843
845
|
* @param {string} [params.timeInForce] GTC, GTT, IOC, or FOK, default is GTC, limit orders only
|
|
844
846
|
* @param {string} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK
|
package/js/src/pro/bitrue.js
CHANGED
|
@@ -33,15 +33,17 @@ export default class bitrue extends bitrueRest {
|
|
|
33
33
|
},
|
|
34
34
|
'api': {
|
|
35
35
|
'open': {
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
'
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
'
|
|
36
|
+
'v1': {
|
|
37
|
+
'private': {
|
|
38
|
+
'post': {
|
|
39
|
+
'poseidon/api/v1/listenKey': 1,
|
|
40
|
+
},
|
|
41
|
+
'put': {
|
|
42
|
+
'poseidon/api/v1/listenKey/{listenKey}': 1,
|
|
43
|
+
},
|
|
44
|
+
'delete': {
|
|
45
|
+
'poseidon/api/v1/listenKey/{listenKey}': 1,
|
|
46
|
+
},
|
|
45
47
|
},
|
|
46
48
|
},
|
|
47
49
|
},
|
|
@@ -414,7 +416,7 @@ export default class bitrue extends bitrueRest {
|
|
|
414
416
|
async authenticate(params = {}) {
|
|
415
417
|
const listenKey = this.safeValue(this.options, 'listenKey');
|
|
416
418
|
if (listenKey === undefined) {
|
|
417
|
-
const response = await this.
|
|
419
|
+
const response = await this.openV1PrivatePostPoseidonApiV1ListenKey(params);
|
|
418
420
|
//
|
|
419
421
|
// {
|
|
420
422
|
// "msg": "succ",
|
|
@@ -439,7 +441,7 @@ export default class bitrue extends bitrueRest {
|
|
|
439
441
|
'listenKey': listenKey,
|
|
440
442
|
};
|
|
441
443
|
try {
|
|
442
|
-
await this.
|
|
444
|
+
await this.openV1PrivatePutPoseidonApiV1ListenKeyListenKey(this.extend(request, params));
|
|
443
445
|
//
|
|
444
446
|
// ಠ_ಠ
|
|
445
447
|
// {
|
package/js/src/pro/idex.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export default class idex extends idexRest {
|
|
|
9
9
|
* @method
|
|
10
10
|
* @name idex#watchTicker
|
|
11
11
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
12
|
+
* @see https://api-docs-v4.idex.io/#tickers
|
|
12
13
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
13
14
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
14
15
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -19,6 +20,7 @@ export default class idex extends idexRest {
|
|
|
19
20
|
* @method
|
|
20
21
|
* @name idex#watchTrades
|
|
21
22
|
* @description get the list of most recent trades for a particular symbol
|
|
23
|
+
* @see https://api-docs-v4.idex.io/#trades
|
|
22
24
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
23
25
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
24
26
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -32,6 +34,7 @@ export default class idex extends idexRest {
|
|
|
32
34
|
* @method
|
|
33
35
|
* @name idex#watchOHLCV
|
|
34
36
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
37
|
+
* @see https://api-docs-v4.idex.io/#candles
|
|
35
38
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
36
39
|
* @param {string} timeframe the length of time each candle represents
|
|
37
40
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -47,6 +50,7 @@ export default class idex extends idexRest {
|
|
|
47
50
|
* @method
|
|
48
51
|
* @name idex#watchOrderBook
|
|
49
52
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
53
|
+
* @see https://api-docs-v4.idex.io/#l2-order-book
|
|
50
54
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
51
55
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
52
56
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -62,6 +66,7 @@ export default class idex extends idexRest {
|
|
|
62
66
|
* @method
|
|
63
67
|
* @name idex#watchOrders
|
|
64
68
|
* @description watches information on multiple orders made by the user
|
|
69
|
+
* @see https://api-docs-v4.idex.io/#orders
|
|
65
70
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
66
71
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
67
72
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
package/js/src/pro/idex.js
CHANGED
|
@@ -70,6 +70,7 @@ export default class idex extends idexRest {
|
|
|
70
70
|
* @method
|
|
71
71
|
* @name idex#watchTicker
|
|
72
72
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
73
|
+
* @see https://api-docs-v4.idex.io/#tickers
|
|
73
74
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
74
75
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
75
76
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -142,6 +143,7 @@ export default class idex extends idexRest {
|
|
|
142
143
|
* @method
|
|
143
144
|
* @name idex#watchTrades
|
|
144
145
|
* @description get the list of most recent trades for a particular symbol
|
|
146
|
+
* @see https://api-docs-v4.idex.io/#trades
|
|
145
147
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
146
148
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
147
149
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -236,6 +238,7 @@ export default class idex extends idexRest {
|
|
|
236
238
|
* @method
|
|
237
239
|
* @name idex#watchOHLCV
|
|
238
240
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
241
|
+
* @see https://api-docs-v4.idex.io/#candles
|
|
239
242
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
240
243
|
* @param {string} timeframe the length of time each candle represents
|
|
241
244
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -406,6 +409,7 @@ export default class idex extends idexRest {
|
|
|
406
409
|
* @method
|
|
407
410
|
* @name idex#watchOrderBook
|
|
408
411
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
412
|
+
* @see https://api-docs-v4.idex.io/#l2-order-book
|
|
409
413
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
410
414
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
411
415
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -509,6 +513,7 @@ export default class idex extends idexRest {
|
|
|
509
513
|
* @method
|
|
510
514
|
* @name idex#watchOrders
|
|
511
515
|
* @description watches information on multiple orders made by the user
|
|
516
|
+
* @see https://api-docs-v4.idex.io/#orders
|
|
512
517
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
513
518
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
514
519
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
package/js/src/pro/probit.d.ts
CHANGED
|
@@ -78,7 +78,8 @@ export default class probit extends probitRest {
|
|
|
78
78
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
79
79
|
*/
|
|
80
80
|
watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
81
|
-
|
|
81
|
+
subscribePrivate(messageHash: any, channel: any, params: any): Promise<any>;
|
|
82
|
+
subscribePublic(methodName: string, symbol: string, dataType: any, filter: any, params?: {}): Promise<any>;
|
|
82
83
|
handleOrderBook(client: Client, message: any, orderBook: any): void;
|
|
83
84
|
handleBidAsks(bookSide: any, bidAsks: any): void;
|
|
84
85
|
handleDelta(orderbook: any, delta: any): void;
|
package/js/src/pro/probit.js
CHANGED
|
@@ -37,15 +37,6 @@ export default class probit extends probitRest {
|
|
|
37
37
|
'filter': 'order_books_l2',
|
|
38
38
|
'interval': 100, // or 500
|
|
39
39
|
},
|
|
40
|
-
'watchTrades': {
|
|
41
|
-
'filter': 'recent_trades',
|
|
42
|
-
},
|
|
43
|
-
'watchTicker': {
|
|
44
|
-
'filter': 'ticker',
|
|
45
|
-
},
|
|
46
|
-
'watchOrders': {
|
|
47
|
-
'channel': 'open_order',
|
|
48
|
-
},
|
|
49
40
|
},
|
|
50
41
|
'streaming': {},
|
|
51
42
|
});
|
|
@@ -61,13 +52,7 @@ export default class probit extends probitRest {
|
|
|
61
52
|
async watchBalance(params = {}) {
|
|
62
53
|
await this.authenticate(params);
|
|
63
54
|
const messageHash = 'balance';
|
|
64
|
-
|
|
65
|
-
const subscribe = {
|
|
66
|
-
'type': 'subscribe',
|
|
67
|
-
'channel': 'balance',
|
|
68
|
-
};
|
|
69
|
-
const request = this.extend(subscribe, params);
|
|
70
|
-
return await this.watch(url, messageHash, request, messageHash);
|
|
55
|
+
return await this.subscribePrivate(messageHash, 'balance', params);
|
|
71
56
|
}
|
|
72
57
|
handleBalance(client, message) {
|
|
73
58
|
//
|
|
@@ -127,9 +112,8 @@ export default class probit extends probitRest {
|
|
|
127
112
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
128
113
|
*/
|
|
129
114
|
async watchTicker(symbol, params = {}) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return await this.subscribeOrderBook(symbol, 'ticker', filter, params);
|
|
115
|
+
const channel = 'ticker';
|
|
116
|
+
return await this.subscribePublic('watchTicker', symbol, 'ticker', channel, params);
|
|
133
117
|
}
|
|
134
118
|
handleTicker(client, message) {
|
|
135
119
|
//
|
|
@@ -172,9 +156,8 @@ export default class probit extends probitRest {
|
|
|
172
156
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
173
157
|
*/
|
|
174
158
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const trades = await this.subscribeOrderBook(symbol, 'trades', filter, params);
|
|
159
|
+
const channel = 'recent_trades';
|
|
160
|
+
const trades = await this.subscribePublic('watchTrades', symbol, 'trades', channel, params);
|
|
178
161
|
if (this.newUpdates) {
|
|
179
162
|
limit = trades.getLimit(symbol, limit);
|
|
180
163
|
}
|
|
@@ -205,10 +188,12 @@ export default class probit extends probitRest {
|
|
|
205
188
|
const symbol = this.safeSymbol(marketId);
|
|
206
189
|
const market = this.safeMarket(marketId);
|
|
207
190
|
const trades = this.safeValue(message, 'recent_trades', []);
|
|
208
|
-
|
|
191
|
+
if (this.safeBool(message, 'reset', false)) {
|
|
192
|
+
return; // see comment in handleMessage
|
|
193
|
+
}
|
|
209
194
|
const messageHash = 'trades:' + symbol;
|
|
210
195
|
let stored = this.safeValue(this.trades, symbol);
|
|
211
|
-
if (stored === undefined
|
|
196
|
+
if (stored === undefined) {
|
|
212
197
|
const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
213
198
|
stored = new ArrayCache(limit);
|
|
214
199
|
this.trades[symbol] = stored;
|
|
@@ -235,20 +220,12 @@ export default class probit extends probitRest {
|
|
|
235
220
|
async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
236
221
|
await this.loadMarkets();
|
|
237
222
|
await this.authenticate(params);
|
|
238
|
-
let messageHash = '
|
|
223
|
+
let messageHash = 'trades';
|
|
239
224
|
if (symbol !== undefined) {
|
|
240
|
-
|
|
241
|
-
symbol = market['symbol'];
|
|
225
|
+
symbol = this.safeSymbol(symbol);
|
|
242
226
|
messageHash = messageHash + ':' + symbol;
|
|
243
227
|
}
|
|
244
|
-
const
|
|
245
|
-
const channel = 'trade_history';
|
|
246
|
-
const message = {
|
|
247
|
-
'type': 'subscribe',
|
|
248
|
-
'channel': channel,
|
|
249
|
-
};
|
|
250
|
-
const request = this.extend(message, params);
|
|
251
|
-
const trades = await this.watch(url, messageHash, request, channel);
|
|
228
|
+
const trades = await this.subscribePrivate(messageHash, 'trade_history', params);
|
|
252
229
|
if (this.newUpdates) {
|
|
253
230
|
limit = trades.getLimit(symbol, limit);
|
|
254
231
|
}
|
|
@@ -279,10 +256,12 @@ export default class probit extends probitRest {
|
|
|
279
256
|
if (length === 0) {
|
|
280
257
|
return;
|
|
281
258
|
}
|
|
282
|
-
|
|
283
|
-
|
|
259
|
+
if (this.safeBool(message, 'reset', false)) {
|
|
260
|
+
return; // see comment in handleMessage
|
|
261
|
+
}
|
|
262
|
+
const messageHash = 'trades';
|
|
284
263
|
let stored = this.myTrades;
|
|
285
|
-
if (
|
|
264
|
+
if (stored === undefined) {
|
|
286
265
|
const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
287
266
|
stored = new ArrayCacheBySymbolById(limit);
|
|
288
267
|
this.myTrades = stored;
|
|
@@ -291,10 +270,18 @@ export default class probit extends probitRest {
|
|
|
291
270
|
const tradeSymbols = {};
|
|
292
271
|
for (let j = 0; j < trades.length; j++) {
|
|
293
272
|
const trade = trades[j];
|
|
273
|
+
// don't include 'executed' state, because it's just blanket state of the trade, emited before actual trade event
|
|
274
|
+
if (this.safeString(trade['info'], 'status') === 'executed') {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
294
277
|
tradeSymbols[trade['symbol']] = true;
|
|
295
278
|
stored.append(trade);
|
|
296
279
|
}
|
|
297
280
|
const unique = Object.keys(tradeSymbols);
|
|
281
|
+
const uniqueLength = unique.length;
|
|
282
|
+
if (uniqueLength === 0) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
298
285
|
for (let i = 0; i < unique.length; i++) {
|
|
299
286
|
const symbol = unique[i];
|
|
300
287
|
const symbolSpecificMessageHash = messageHash + ':' + symbol;
|
|
@@ -316,21 +303,12 @@ export default class probit extends probitRest {
|
|
|
316
303
|
*/
|
|
317
304
|
async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
318
305
|
await this.authenticate(params);
|
|
319
|
-
const url = this.urls['api']['ws'];
|
|
320
306
|
let messageHash = 'orders';
|
|
321
307
|
if (symbol !== undefined) {
|
|
322
|
-
|
|
323
|
-
symbol = market['symbol'];
|
|
308
|
+
symbol = this.safeSymbol(symbol);
|
|
324
309
|
messageHash = messageHash + ':' + symbol;
|
|
325
310
|
}
|
|
326
|
-
|
|
327
|
-
[channel, params] = this.handleOptionAndParams(params, 'watchOrders', 'channel', 'open_order');
|
|
328
|
-
const subscribe = {
|
|
329
|
-
'type': 'subscribe',
|
|
330
|
-
'channel': channel,
|
|
331
|
-
};
|
|
332
|
-
const request = this.extend(subscribe, params);
|
|
333
|
-
const orders = await this.watch(url, messageHash, request, channel);
|
|
311
|
+
const orders = await this.subscribePrivate(messageHash, 'open_order', params);
|
|
334
312
|
if (this.newUpdates) {
|
|
335
313
|
limit = orders.getLimit(symbol, limit);
|
|
336
314
|
}
|
|
@@ -400,41 +378,51 @@ export default class probit extends probitRest {
|
|
|
400
378
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
401
379
|
*/
|
|
402
380
|
async watchOrderBook(symbol, limit = undefined, params = {}) {
|
|
403
|
-
let
|
|
404
|
-
[
|
|
405
|
-
const orderbook = await this.
|
|
381
|
+
let channel = undefined;
|
|
382
|
+
[channel, params] = this.handleOptionAndParams(params, 'watchOrderBook', 'filter', 'order_books');
|
|
383
|
+
const orderbook = await this.subscribePublic('watchOrderBook', symbol, 'orderbook', channel, params);
|
|
406
384
|
return orderbook.limit();
|
|
407
385
|
}
|
|
408
|
-
async
|
|
386
|
+
async subscribePrivate(messageHash, channel, params) {
|
|
387
|
+
const url = this.urls['api']['ws'];
|
|
388
|
+
const subscribe = {
|
|
389
|
+
'type': 'subscribe',
|
|
390
|
+
'channel': channel,
|
|
391
|
+
};
|
|
392
|
+
const request = this.extend(subscribe, params);
|
|
393
|
+
const subscribeHash = messageHash;
|
|
394
|
+
return await this.watch(url, messageHash, request, subscribeHash);
|
|
395
|
+
}
|
|
396
|
+
async subscribePublic(methodName, symbol, dataType, filter, params = {}) {
|
|
409
397
|
await this.loadMarkets();
|
|
410
398
|
const market = this.market(symbol);
|
|
411
399
|
symbol = market['symbol'];
|
|
412
400
|
const url = this.urls['api']['ws'];
|
|
413
401
|
const client = this.client(url);
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
const subscriptionHash = 'marketdata:' + symbol;
|
|
417
|
-
messageHash = messageHash + ':' + symbol;
|
|
402
|
+
const subscribeHash = 'marketdata:' + symbol;
|
|
403
|
+
const messageHash = dataType + ':' + symbol;
|
|
418
404
|
let filters = {};
|
|
419
|
-
if (
|
|
405
|
+
if (subscribeHash in client.subscriptions) {
|
|
420
406
|
// already subscribed
|
|
421
|
-
filters = client.subscriptions[
|
|
407
|
+
filters = client.subscriptions[subscribeHash];
|
|
422
408
|
if (!(filter in filters)) {
|
|
423
409
|
// resubscribe
|
|
424
|
-
delete client.subscriptions[
|
|
410
|
+
delete client.subscriptions[subscribeHash];
|
|
425
411
|
}
|
|
426
412
|
}
|
|
427
413
|
filters[filter] = true;
|
|
428
414
|
const keys = Object.keys(filters);
|
|
429
|
-
|
|
415
|
+
let interval = undefined;
|
|
416
|
+
[interval, params] = this.handleOptionAndParams(params, methodName, 'interval', 100);
|
|
417
|
+
let request = {
|
|
418
|
+
'type': 'subscribe',
|
|
430
419
|
'channel': 'marketdata',
|
|
431
|
-
'interval': interval,
|
|
432
420
|
'market_id': market['id'],
|
|
433
|
-
'type': 'subscribe',
|
|
434
421
|
'filter': keys,
|
|
422
|
+
'interval': interval,
|
|
435
423
|
};
|
|
436
|
-
|
|
437
|
-
return await this.watch(url, messageHash, request,
|
|
424
|
+
request = this.extend(request, params);
|
|
425
|
+
return await this.watch(url, messageHash, request, subscribeHash, filters);
|
|
438
426
|
}
|
|
439
427
|
handleOrderBook(client, message, orderBook) {
|
|
440
428
|
//
|
|
@@ -513,7 +501,8 @@ export default class probit extends probitRest {
|
|
|
513
501
|
const result = this.safeString(message, 'result');
|
|
514
502
|
const future = client.subscriptions['authenticated'];
|
|
515
503
|
if (result === 'ok') {
|
|
516
|
-
|
|
504
|
+
const messageHash = 'authenticated';
|
|
505
|
+
client.resolve(message, messageHash);
|
|
517
506
|
}
|
|
518
507
|
else {
|
|
519
508
|
future.reject(message);
|
|
@@ -526,11 +515,13 @@ export default class probit extends probitRest {
|
|
|
526
515
|
this.handleTicker(client, message);
|
|
527
516
|
}
|
|
528
517
|
const trades = this.safeValue(message, 'recent_trades', []);
|
|
529
|
-
|
|
518
|
+
const tradesLength = trades.length;
|
|
519
|
+
if (tradesLength) {
|
|
530
520
|
this.handleTrades(client, message);
|
|
531
521
|
}
|
|
532
522
|
const orderBook = this.safeValueN(message, ['order_books', 'order_books_l1', 'order_books_l2', 'order_books_l3', 'order_books_l4'], []);
|
|
533
|
-
|
|
523
|
+
const orderBookLength = orderBook.length;
|
|
524
|
+
if (orderBookLength) {
|
|
534
525
|
this.handleOrderBook(client, message, orderBook);
|
|
535
526
|
}
|
|
536
527
|
}
|
|
@@ -544,6 +535,9 @@ export default class probit extends probitRest {
|
|
|
544
535
|
// }
|
|
545
536
|
// }
|
|
546
537
|
//
|
|
538
|
+
// Note about 'reset' field
|
|
539
|
+
// 'reset': true field - it happens once after initial subscription, which just returns old items by the moment of subscription (like "fetchMyTrades" does)
|
|
540
|
+
//
|
|
547
541
|
const errorCode = this.safeString(message, 'errorCode');
|
|
548
542
|
if (errorCode !== undefined) {
|
|
549
543
|
this.handleErrorMessage(client, message);
|
package/js/src/pro/woo.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export default class woo extends wooRest {
|
|
|
8
8
|
/**
|
|
9
9
|
* @method
|
|
10
10
|
* @name woo#watchOrderBook
|
|
11
|
-
* @see https://docs.
|
|
12
|
-
* @see https://docs.
|
|
11
|
+
* @see https://docs.woox.io/#orderbookupdate
|
|
12
|
+
* @see https://docs.woox.io/#orderbook
|
|
13
13
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
14
14
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
15
15
|
* @param {int} [limit] the maximum amount of order book entries to return.
|
|
@@ -38,7 +38,7 @@ export default class woo extends wooRest {
|
|
|
38
38
|
/**
|
|
39
39
|
* @method
|
|
40
40
|
* @name woo#watchTickers
|
|
41
|
-
* @see https://docs.
|
|
41
|
+
* @see https://docs.woox.io/#24h-tickers
|
|
42
42
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
43
43
|
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
44
44
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -62,7 +62,7 @@ export default class woo extends wooRest {
|
|
|
62
62
|
* @method
|
|
63
63
|
* @name woo#watchOHLCV
|
|
64
64
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
65
|
-
* @see https://docs.
|
|
65
|
+
* @see https://docs.woox.io/#k-line
|
|
66
66
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
67
67
|
* @param {string} timeframe the length of time each candle represents
|
|
68
68
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -76,7 +76,7 @@ export default class woo extends wooRest {
|
|
|
76
76
|
* @method
|
|
77
77
|
* @name woo#watchTrades
|
|
78
78
|
* @description watches information on multiple trades made in a market
|
|
79
|
-
* @see https://docs.
|
|
79
|
+
* @see https://docs.woox.io/#trade
|
|
80
80
|
* @param {string} symbol unified market symbol of the market trades were made in
|
|
81
81
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
82
82
|
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
@@ -93,8 +93,8 @@ export default class woo extends wooRest {
|
|
|
93
93
|
/**
|
|
94
94
|
* @method
|
|
95
95
|
* @name woo#watchOrders
|
|
96
|
-
* @see https://docs.
|
|
97
|
-
* @see https://docs.
|
|
96
|
+
* @see https://docs.woox.io/#executionreport
|
|
97
|
+
* @see https://docs.woox.io/#algoexecutionreportv2
|
|
98
98
|
* @description watches information on multiple orders made by the user
|
|
99
99
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
100
100
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -107,8 +107,8 @@ export default class woo extends wooRest {
|
|
|
107
107
|
/**
|
|
108
108
|
* @method
|
|
109
109
|
* @name woo#watchMyTrades
|
|
110
|
-
* @see https://docs.
|
|
111
|
-
* @see https://docs.
|
|
110
|
+
* @see https://docs.woox.io/#executionreport
|
|
111
|
+
* @see https://docs.woox.io/#algoexecutionreportv2
|
|
112
112
|
* @description watches information on multiple trades made by the user
|
|
113
113
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
114
114
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -125,7 +125,7 @@ export default class woo extends wooRest {
|
|
|
125
125
|
/**
|
|
126
126
|
* @method
|
|
127
127
|
* @name woo#watchPositions
|
|
128
|
-
* @see https://docs.
|
|
128
|
+
* @see https://docs.woox.io/#position-push
|
|
129
129
|
* @description watch all open positions
|
|
130
130
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
131
131
|
* @param since
|
|
@@ -139,7 +139,7 @@ export default class woo extends wooRest {
|
|
|
139
139
|
handlePositions(client: any, message: any): void;
|
|
140
140
|
/**
|
|
141
141
|
* @method
|
|
142
|
-
* @see https://docs.
|
|
142
|
+
* @see https://docs.woox.io/#balance
|
|
143
143
|
* @name woo#watchBalance
|
|
144
144
|
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
145
145
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
package/js/src/pro/woo.js
CHANGED
|
@@ -31,14 +31,14 @@ export default class woo extends wooRest {
|
|
|
31
31
|
'urls': {
|
|
32
32
|
'api': {
|
|
33
33
|
'ws': {
|
|
34
|
-
'public': 'wss://wss.
|
|
35
|
-
'private': 'wss://wss.
|
|
34
|
+
'public': 'wss://wss.woox.io/ws/stream',
|
|
35
|
+
'private': 'wss://wss.woox.io/v2/ws/private/stream',
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
38
|
'test': {
|
|
39
39
|
'ws': {
|
|
40
|
-
'public': 'wss://wss.staging.
|
|
41
|
-
'private': 'wss://wss.staging.
|
|
40
|
+
'public': 'wss://wss.staging.woox.io/ws/stream',
|
|
41
|
+
'private': 'wss://wss.staging.woox.io/v2/ws/private/stream',
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
},
|
|
@@ -89,8 +89,8 @@ export default class woo extends wooRest {
|
|
|
89
89
|
/**
|
|
90
90
|
* @method
|
|
91
91
|
* @name woo#watchOrderBook
|
|
92
|
-
* @see https://docs.
|
|
93
|
-
* @see https://docs.
|
|
92
|
+
* @see https://docs.woox.io/#orderbookupdate
|
|
93
|
+
* @see https://docs.woox.io/#orderbook
|
|
94
94
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
95
95
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
96
96
|
* @param {int} [limit] the maximum amount of order book entries to return.
|
|
@@ -343,7 +343,7 @@ export default class woo extends wooRest {
|
|
|
343
343
|
/**
|
|
344
344
|
* @method
|
|
345
345
|
* @name woo#watchTickers
|
|
346
|
-
* @see https://docs.
|
|
346
|
+
* @see https://docs.woox.io/#24h-tickers
|
|
347
347
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
348
348
|
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
349
349
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -480,7 +480,7 @@ export default class woo extends wooRest {
|
|
|
480
480
|
* @method
|
|
481
481
|
* @name woo#watchOHLCV
|
|
482
482
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
483
|
-
* @see https://docs.
|
|
483
|
+
* @see https://docs.woox.io/#k-line
|
|
484
484
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
485
485
|
* @param {string} timeframe the length of time each candle represents
|
|
486
486
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -556,7 +556,7 @@ export default class woo extends wooRest {
|
|
|
556
556
|
* @method
|
|
557
557
|
* @name woo#watchTrades
|
|
558
558
|
* @description watches information on multiple trades made in a market
|
|
559
|
-
* @see https://docs.
|
|
559
|
+
* @see https://docs.woox.io/#trade
|
|
560
560
|
* @param {string} symbol unified market symbol of the market trades were made in
|
|
561
561
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
562
562
|
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
@@ -746,8 +746,8 @@ export default class woo extends wooRest {
|
|
|
746
746
|
/**
|
|
747
747
|
* @method
|
|
748
748
|
* @name woo#watchOrders
|
|
749
|
-
* @see https://docs.
|
|
750
|
-
* @see https://docs.
|
|
749
|
+
* @see https://docs.woox.io/#executionreport
|
|
750
|
+
* @see https://docs.woox.io/#algoexecutionreportv2
|
|
751
751
|
* @description watches information on multiple orders made by the user
|
|
752
752
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
753
753
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -781,8 +781,8 @@ export default class woo extends wooRest {
|
|
|
781
781
|
/**
|
|
782
782
|
* @method
|
|
783
783
|
* @name woo#watchMyTrades
|
|
784
|
-
* @see https://docs.
|
|
785
|
-
* @see https://docs.
|
|
784
|
+
* @see https://docs.woox.io/#executionreport
|
|
785
|
+
* @see https://docs.woox.io/#algoexecutionreportv2
|
|
786
786
|
* @description watches information on multiple trades made by the user
|
|
787
787
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
788
788
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -1021,7 +1021,7 @@ export default class woo extends wooRest {
|
|
|
1021
1021
|
/**
|
|
1022
1022
|
* @method
|
|
1023
1023
|
* @name woo#watchPositions
|
|
1024
|
-
* @see https://docs.
|
|
1024
|
+
* @see https://docs.woox.io/#position-push
|
|
1025
1025
|
* @description watch all open positions
|
|
1026
1026
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
1027
1027
|
* @param since
|
|
@@ -1138,7 +1138,7 @@ export default class woo extends wooRest {
|
|
|
1138
1138
|
}
|
|
1139
1139
|
/**
|
|
1140
1140
|
* @method
|
|
1141
|
-
* @see https://docs.
|
|
1141
|
+
* @see https://docs.woox.io/#balance
|
|
1142
1142
|
* @name woo#watchBalance
|
|
1143
1143
|
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
1144
1144
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
package/js/src/vertex.js
CHANGED
|
@@ -51,6 +51,8 @@ export default class vertex extends Exchange {
|
|
|
51
51
|
'createOrder': true,
|
|
52
52
|
'createOrders': true,
|
|
53
53
|
'createReduceOnlyOrder': true,
|
|
54
|
+
'createStopOrder': true,
|
|
55
|
+
'createTriggerOrder': true,
|
|
54
56
|
'editOrder': false,
|
|
55
57
|
'fetchAccounts': false,
|
|
56
58
|
'fetchBalance': true,
|