ccxt 4.2.7 → 4.2.9
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 +3 -3
- package/build.sh +18 -2
- package/dist/ccxt.browser.js +250 -51
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +18 -5
- package/dist/cjs/src/bingx.js +15 -0
- package/dist/cjs/src/bitmart.js +94 -15
- package/dist/cjs/src/bybit.js +23 -3
- package/dist/cjs/src/okx.js +46 -15
- package/dist/cjs/src/pro/binance.js +17 -1
- package/dist/cjs/src/pro/bitget.js +3 -1
- package/dist/cjs/src/pro/bitmart.js +18 -3
- package/dist/cjs/src/pro/bybit.js +3 -1
- package/dist/cjs/src/pro/coinbasepro.js +1 -2
- package/dist/cjs/src/pro/cryptocom.js +9 -3
- package/dist/cjs/src/pro/poloniex.js +2 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/binance.js +18 -5
- package/js/src/bingx.d.ts +1 -0
- package/js/src/bingx.js +16 -1
- package/js/src/bitmart.js +95 -16
- package/js/src/bybit.js +23 -3
- package/js/src/okx.js +46 -15
- package/js/src/pro/binance.js +17 -1
- package/js/src/pro/bitget.js +3 -1
- package/js/src/pro/bitmart.js +18 -3
- package/js/src/pro/bybit.js +3 -1
- package/js/src/pro/coinbasepro.js +1 -2
- package/js/src/pro/cryptocom.js +9 -3
- package/js/src/pro/poloniex.js +2 -1
- package/package.json +1 -1
package/js/src/okx.js
CHANGED
|
@@ -2590,6 +2590,8 @@ export default class okx extends Exchange {
|
|
|
2590
2590
|
const stopLossDefined = (stopLoss !== undefined);
|
|
2591
2591
|
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
2592
2592
|
const takeProfitDefined = (takeProfit !== undefined);
|
|
2593
|
+
const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRatio');
|
|
2594
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
2593
2595
|
const defaultMarginMode = this.safeString2(this.options, 'defaultMarginMode', 'marginMode', 'cross');
|
|
2594
2596
|
let marginMode = this.safeString2(params, 'marginMode', 'tdMode'); // cross or isolated, tdMode not ommited so as to be extended into the request
|
|
2595
2597
|
let margin = false;
|
|
@@ -2622,7 +2624,7 @@ export default class okx extends Exchange {
|
|
|
2622
2624
|
const isMarketOrder = type === 'market';
|
|
2623
2625
|
let postOnly = false;
|
|
2624
2626
|
[postOnly, params] = this.handlePostOnly(isMarketOrder, type === 'post_only', params);
|
|
2625
|
-
params = this.omit(params, ['currency', 'ccy', 'marginMode', 'timeInForce', 'stopPrice', 'triggerPrice', 'clientOrderId', 'stopLossPrice', 'takeProfitPrice', 'slOrdPx', 'tpOrdPx', 'margin', 'stopLoss', 'takeProfit']);
|
|
2627
|
+
params = this.omit(params, ['currency', 'ccy', 'marginMode', 'timeInForce', 'stopPrice', 'triggerPrice', 'clientOrderId', 'stopLossPrice', 'takeProfitPrice', 'slOrdPx', 'tpOrdPx', 'margin', 'stopLoss', 'takeProfit', 'trailingPercent']);
|
|
2626
2628
|
const ioc = (timeInForce === 'IOC') || (type === 'ioc');
|
|
2627
2629
|
const fok = (timeInForce === 'FOK') || (type === 'fok');
|
|
2628
2630
|
const trigger = (triggerPrice !== undefined) || (type === 'trigger');
|
|
@@ -2681,7 +2683,12 @@ export default class okx extends Exchange {
|
|
|
2681
2683
|
else if (fok) {
|
|
2682
2684
|
request['ordType'] = 'fok';
|
|
2683
2685
|
}
|
|
2684
|
-
if (
|
|
2686
|
+
if (isTrailingPercentOrder) {
|
|
2687
|
+
const convertedTrailingPercent = Precise.stringDiv(trailingPercent, '100');
|
|
2688
|
+
request['callbackRatio'] = convertedTrailingPercent;
|
|
2689
|
+
request['ordType'] = 'move_order_stop';
|
|
2690
|
+
}
|
|
2691
|
+
else if (stopLossDefined || takeProfitDefined) {
|
|
2685
2692
|
if (stopLossDefined) {
|
|
2686
2693
|
const stopLossTriggerPrice = this.safeValueN(stopLoss, ['triggerPrice', 'stopPrice', 'slTriggerPx']);
|
|
2687
2694
|
if (stopLossTriggerPrice === undefined) {
|
|
@@ -2825,6 +2832,7 @@ export default class okx extends Exchange {
|
|
|
2825
2832
|
* @param {float} [params.stopLoss.price] used for stop loss limit orders, not used for stop loss market price orders
|
|
2826
2833
|
* @param {string} [params.stopLoss.type] 'market' or 'limit' used to specify the stop loss price type
|
|
2827
2834
|
* @param {string} [params.positionSide] if position mode is one-way: set to 'net', if position mode is hedge-mode: set to 'long' or 'short'
|
|
2835
|
+
* @param {string} [params.trailingPercent] the percent to trail away from the current market price
|
|
2828
2836
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2829
2837
|
*/
|
|
2830
2838
|
await this.loadMarkets();
|
|
@@ -2832,7 +2840,7 @@ export default class okx extends Exchange {
|
|
|
2832
2840
|
let request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
2833
2841
|
let method = this.safeString(this.options, 'createOrder', 'privatePostTradeBatchOrders');
|
|
2834
2842
|
const requestOrdType = this.safeString(request, 'ordType');
|
|
2835
|
-
if ((requestOrdType === 'trigger') || (requestOrdType === 'conditional') || (
|
|
2843
|
+
if ((requestOrdType === 'trigger') || (requestOrdType === 'conditional') || (requestOrdType === 'move_order_stop') || (type === 'move_order_stop') || (type === 'oco') || (type === 'iceberg') || (type === 'twap')) {
|
|
2836
2844
|
method = 'privatePostTradeOrderAlgo';
|
|
2837
2845
|
}
|
|
2838
2846
|
if ((method !== 'privatePostTradeOrder') && (method !== 'privatePostTradeOrderAlgo') && (method !== 'privatePostTradeBatchOrders')) {
|
|
@@ -3029,17 +3037,20 @@ export default class okx extends Exchange {
|
|
|
3029
3037
|
* @name okx#cancelOrder
|
|
3030
3038
|
* @description cancels an open order
|
|
3031
3039
|
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-order
|
|
3040
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
|
|
3032
3041
|
* @param {string} id order id
|
|
3033
3042
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
3034
3043
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3035
3044
|
* @param {boolean} [params.trigger] true if trigger orders
|
|
3045
|
+
* @param {boolean} [params.trailing] set to true if you want to cancel a trailing order
|
|
3036
3046
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3037
3047
|
*/
|
|
3038
3048
|
if (symbol === undefined) {
|
|
3039
3049
|
throw new ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
3040
3050
|
}
|
|
3041
3051
|
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
3042
|
-
|
|
3052
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
3053
|
+
if (stop || trailing) {
|
|
3043
3054
|
const orderInner = await this.cancelOrders([id], symbol, params);
|
|
3044
3055
|
return this.safeValue(orderInner, 0);
|
|
3045
3056
|
}
|
|
@@ -3090,6 +3101,7 @@ export default class okx extends Exchange {
|
|
|
3090
3101
|
* @param {string} symbol unified market symbol
|
|
3091
3102
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3092
3103
|
* @param {boolean} [params.trigger] whether the order is a stop/trigger order
|
|
3104
|
+
* @param {boolean} [params.trailing] set to true if you want to cancel trailing orders
|
|
3093
3105
|
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3094
3106
|
*/
|
|
3095
3107
|
// TODO : the original endpoint signature differs, according to that you can skip individual symbol and assign ids in batch. At this moment, `params` is not being used too.
|
|
@@ -3105,7 +3117,8 @@ export default class okx extends Exchange {
|
|
|
3105
3117
|
const clientOrderIds = this.parseIds(this.safeValue2(params, 'clOrdId', 'clientOrderId'));
|
|
3106
3118
|
const algoIds = this.parseIds(this.safeValue(params, 'algoId'));
|
|
3107
3119
|
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
3108
|
-
|
|
3120
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
3121
|
+
if (stop || trailing) {
|
|
3109
3122
|
method = 'privatePostTradeCancelAlgos';
|
|
3110
3123
|
}
|
|
3111
3124
|
if (clientOrderIds === undefined) {
|
|
@@ -3119,7 +3132,7 @@ export default class okx extends Exchange {
|
|
|
3119
3132
|
}
|
|
3120
3133
|
}
|
|
3121
3134
|
for (let i = 0; i < ids.length; i++) {
|
|
3122
|
-
if (stop) {
|
|
3135
|
+
if (trailing || stop) {
|
|
3123
3136
|
request.push({
|
|
3124
3137
|
'algoId': ids[i],
|
|
3125
3138
|
'instId': market['id'],
|
|
@@ -3558,7 +3571,6 @@ export default class okx extends Exchange {
|
|
|
3558
3571
|
/**
|
|
3559
3572
|
* @method
|
|
3560
3573
|
* @name okx#fetchOpenOrders
|
|
3561
|
-
* @description Fetch orders that are still open
|
|
3562
3574
|
* @description fetch all unfilled currently open orders
|
|
3563
3575
|
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-list
|
|
3564
3576
|
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-list
|
|
@@ -3571,6 +3583,7 @@ export default class okx extends Exchange {
|
|
|
3571
3583
|
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
3572
3584
|
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
3573
3585
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
3586
|
+
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
3574
3587
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3575
3588
|
*/
|
|
3576
3589
|
await this.loadMarkets();
|
|
@@ -3603,15 +3616,21 @@ export default class okx extends Exchange {
|
|
|
3603
3616
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
3604
3617
|
const ordType = this.safeString(params, 'ordType');
|
|
3605
3618
|
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
3606
|
-
|
|
3619
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
3620
|
+
if (trailing || stop || (ordType in algoOrderTypes)) {
|
|
3607
3621
|
method = 'privateGetTradeOrdersAlgoPending';
|
|
3622
|
+
}
|
|
3623
|
+
if (trailing) {
|
|
3624
|
+
request['ordType'] = 'move_order_stop';
|
|
3625
|
+
}
|
|
3626
|
+
else if (stop || (ordType in algoOrderTypes)) {
|
|
3608
3627
|
if (stop) {
|
|
3609
3628
|
if (ordType === undefined) {
|
|
3610
3629
|
throw new ArgumentsRequired(this.id + ' fetchOpenOrders() requires an "ordType" string parameter, "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"');
|
|
3611
3630
|
}
|
|
3612
3631
|
}
|
|
3613
3632
|
}
|
|
3614
|
-
const query = this.omit(params, ['method', 'stop', 'trigger']);
|
|
3633
|
+
const query = this.omit(params, ['method', 'stop', 'trigger', 'trailing']);
|
|
3615
3634
|
let response = undefined;
|
|
3616
3635
|
if (method === 'privateGetTradeOrdersAlgoPending') {
|
|
3617
3636
|
response = await this.privateGetTradeOrdersAlgoPending(this.extend(request, query));
|
|
@@ -3732,6 +3751,7 @@ export default class okx extends Exchange {
|
|
|
3732
3751
|
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
3733
3752
|
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
3734
3753
|
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
3754
|
+
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
3735
3755
|
* @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3736
3756
|
*/
|
|
3737
3757
|
await this.loadMarkets();
|
|
@@ -3765,7 +3785,12 @@ export default class okx extends Exchange {
|
|
|
3765
3785
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
3766
3786
|
const ordType = this.safeString(params, 'ordType');
|
|
3767
3787
|
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
3768
|
-
|
|
3788
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
3789
|
+
if (trailing) {
|
|
3790
|
+
method = 'privateGetTradeOrdersAlgoHistory';
|
|
3791
|
+
request['ordType'] = 'move_order_stop';
|
|
3792
|
+
}
|
|
3793
|
+
else if (stop || (ordType in algoOrderTypes)) {
|
|
3769
3794
|
method = 'privateGetTradeOrdersAlgoHistory';
|
|
3770
3795
|
const algoId = this.safeString(params, 'algoId');
|
|
3771
3796
|
if (algoId !== undefined) {
|
|
@@ -3776,7 +3801,6 @@ export default class okx extends Exchange {
|
|
|
3776
3801
|
if (ordType === undefined) {
|
|
3777
3802
|
throw new ArgumentsRequired(this.id + ' fetchCanceledOrders() requires an "ordType" string parameter, "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"');
|
|
3778
3803
|
}
|
|
3779
|
-
request['ordType'] = ordType;
|
|
3780
3804
|
}
|
|
3781
3805
|
}
|
|
3782
3806
|
else {
|
|
@@ -3789,7 +3813,7 @@ export default class okx extends Exchange {
|
|
|
3789
3813
|
query = this.omit(query, ['until', 'till']);
|
|
3790
3814
|
}
|
|
3791
3815
|
}
|
|
3792
|
-
const send = this.omit(query, ['method', 'stop', '
|
|
3816
|
+
const send = this.omit(query, ['method', 'stop', 'trigger', 'trailing']);
|
|
3793
3817
|
let response = undefined;
|
|
3794
3818
|
if (method === 'privateGetTradeOrdersAlgoHistory') {
|
|
3795
3819
|
response = await this.privateGetTradeOrdersAlgoHistory(this.extend(request, send));
|
|
@@ -3917,6 +3941,7 @@ export default class okx extends Exchange {
|
|
|
3917
3941
|
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
3918
3942
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
3919
3943
|
* @param {string} [params.method] method to be used, either 'privateGetTradeOrdersHistory', 'privateGetTradeOrdersHistoryArchive' or 'privateGetTradeOrdersAlgoHistory' default is 'privateGetTradeOrdersHistory'
|
|
3944
|
+
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
3920
3945
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3921
3946
|
*/
|
|
3922
3947
|
await this.loadMarkets();
|
|
@@ -3954,14 +3979,20 @@ export default class okx extends Exchange {
|
|
|
3954
3979
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
3955
3980
|
const ordType = this.safeString(params, 'ordType');
|
|
3956
3981
|
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
3957
|
-
|
|
3982
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
3983
|
+
if (trailing || stop || (ordType in algoOrderTypes)) {
|
|
3958
3984
|
method = 'privateGetTradeOrdersAlgoHistory';
|
|
3985
|
+
request['state'] = 'effective';
|
|
3986
|
+
}
|
|
3987
|
+
if (trailing) {
|
|
3988
|
+
request['ordType'] = 'move_order_stop';
|
|
3989
|
+
}
|
|
3990
|
+
else if (stop || (ordType in algoOrderTypes)) {
|
|
3959
3991
|
if (stop) {
|
|
3960
3992
|
if (ordType === undefined) {
|
|
3961
3993
|
throw new ArgumentsRequired(this.id + ' fetchClosedOrders() requires an "ordType" string parameter, "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"');
|
|
3962
3994
|
}
|
|
3963
3995
|
}
|
|
3964
|
-
request['state'] = 'effective';
|
|
3965
3996
|
}
|
|
3966
3997
|
else {
|
|
3967
3998
|
if (since !== undefined) {
|
|
@@ -3974,7 +4005,7 @@ export default class okx extends Exchange {
|
|
|
3974
4005
|
}
|
|
3975
4006
|
request['state'] = 'filled';
|
|
3976
4007
|
}
|
|
3977
|
-
const send = this.omit(query, ['method', 'stop', 'trigger']);
|
|
4008
|
+
const send = this.omit(query, ['method', 'stop', 'trigger', 'trailing']);
|
|
3978
4009
|
let response = undefined;
|
|
3979
4010
|
if (method === 'privateGetTradeOrdersAlgoHistory') {
|
|
3980
4011
|
response = await this.privateGetTradeOrdersAlgoHistory(this.extend(request, send));
|
package/js/src/pro/binance.js
CHANGED
|
@@ -867,7 +867,10 @@ export default class binance extends binanceRest {
|
|
|
867
867
|
name = this.safeString(params, 'name', name);
|
|
868
868
|
params = this.omit(params, 'name');
|
|
869
869
|
let wsParams = [];
|
|
870
|
-
|
|
870
|
+
let messageHash = 'tickers';
|
|
871
|
+
if (symbols !== undefined) {
|
|
872
|
+
messageHash = 'tickers::' + symbols.join(',');
|
|
873
|
+
}
|
|
871
874
|
if (name === 'bookTicker') {
|
|
872
875
|
if (marketIds === undefined) {
|
|
873
876
|
throw new ArgumentsRequired(this.id + ' watchTickers() requires symbols for bookTicker');
|
|
@@ -1060,6 +1063,19 @@ export default class binance extends binanceRest {
|
|
|
1060
1063
|
this.tickers[symbol] = result;
|
|
1061
1064
|
newTickers.push(result);
|
|
1062
1065
|
}
|
|
1066
|
+
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
1067
|
+
for (let i = 0; i < messageHashes.length; i++) {
|
|
1068
|
+
const messageHash = messageHashes[i];
|
|
1069
|
+
const parts = messageHash.split('::');
|
|
1070
|
+
const symbolsString = parts[1];
|
|
1071
|
+
const symbols = symbolsString.split(',');
|
|
1072
|
+
const tickers = this.filterByArray(newTickers, 'symbol', symbols);
|
|
1073
|
+
const tickersSymbols = Object.keys(tickers);
|
|
1074
|
+
const numTickers = tickersSymbols.length;
|
|
1075
|
+
if (numTickers > 0) {
|
|
1076
|
+
client.resolve(tickers, messageHash);
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1063
1079
|
client.resolve(newTickers, 'tickers');
|
|
1064
1080
|
}
|
|
1065
1081
|
signParams(params = {}) {
|
package/js/src/pro/bitget.js
CHANGED
|
@@ -156,7 +156,9 @@ export default class bitget extends bitgetRest {
|
|
|
156
156
|
}
|
|
157
157
|
const tickers = await this.watchPublicMultiple(messageHashes, topics, params);
|
|
158
158
|
if (this.newUpdates) {
|
|
159
|
-
|
|
159
|
+
const result = {};
|
|
160
|
+
result[tickers['symbol']] = tickers;
|
|
161
|
+
return result;
|
|
160
162
|
}
|
|
161
163
|
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
162
164
|
}
|
package/js/src/pro/bitmart.js
CHANGED
|
@@ -301,7 +301,10 @@ export default class bitmart extends bitmartRest {
|
|
|
301
301
|
if (type === 'swap') {
|
|
302
302
|
type = 'futures';
|
|
303
303
|
}
|
|
304
|
-
|
|
304
|
+
let messageHash = 'tickers';
|
|
305
|
+
if (symbols !== undefined) {
|
|
306
|
+
messageHash += '::' + symbols.join(',');
|
|
307
|
+
}
|
|
305
308
|
const request = {
|
|
306
309
|
'action': 'subscribe',
|
|
307
310
|
'args': ['futures/ticker'],
|
|
@@ -707,7 +710,7 @@ export default class bitmart extends bitmartRest {
|
|
|
707
710
|
// }
|
|
708
711
|
//
|
|
709
712
|
const marketId = this.safeString(position, 'symbol');
|
|
710
|
-
market = this.safeMarket(marketId, market,
|
|
713
|
+
market = this.safeMarket(marketId, market, undefined, 'swap');
|
|
711
714
|
const symbol = market['symbol'];
|
|
712
715
|
const openTimestamp = this.safeInteger(position, 'create_time');
|
|
713
716
|
const timestamp = this.safeInteger(position, 'update_time');
|
|
@@ -900,6 +903,18 @@ export default class bitmart extends bitmartRest {
|
|
|
900
903
|
const symbol = this.safeString(ticker, 'symbol');
|
|
901
904
|
this.tickers[symbol] = ticker;
|
|
902
905
|
client.resolve(ticker, 'tickers');
|
|
906
|
+
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
907
|
+
for (let i = 0; i < messageHashes.length; i++) {
|
|
908
|
+
const messageHash = messageHashes[i];
|
|
909
|
+
const parts = messageHash.split('::');
|
|
910
|
+
const symbolsString = parts[1];
|
|
911
|
+
const symbols = symbolsString.split(',');
|
|
912
|
+
if (this.inArray(symbol, symbols)) {
|
|
913
|
+
const response = {};
|
|
914
|
+
response[symbol] = ticker;
|
|
915
|
+
client.resolve(response, messageHash);
|
|
916
|
+
}
|
|
917
|
+
}
|
|
903
918
|
}
|
|
904
919
|
return message;
|
|
905
920
|
}
|
|
@@ -1049,7 +1064,7 @@ export default class bitmart extends bitmartRest {
|
|
|
1049
1064
|
}
|
|
1050
1065
|
else {
|
|
1051
1066
|
const marketId = this.safeString(data, 'symbol');
|
|
1052
|
-
const market = this.safeMarket(marketId, undefined,
|
|
1067
|
+
const market = this.safeMarket(marketId, undefined, undefined, 'swap');
|
|
1053
1068
|
const symbol = market['symbol'];
|
|
1054
1069
|
const items = this.safeValue(data, 'items', []);
|
|
1055
1070
|
this.ohlcvs[symbol] = this.safeValue(this.ohlcvs, symbol, {});
|
package/js/src/pro/bybit.js
CHANGED
|
@@ -225,7 +225,9 @@ export default class bybit extends bybitRest {
|
|
|
225
225
|
}
|
|
226
226
|
const ticker = await this.watchTopics(url, messageHashes, topics, params);
|
|
227
227
|
if (this.newUpdates) {
|
|
228
|
-
|
|
228
|
+
const result = {};
|
|
229
|
+
result[ticker['symbol']] = ticker;
|
|
230
|
+
return result;
|
|
229
231
|
}
|
|
230
232
|
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
231
233
|
}
|
|
@@ -124,8 +124,7 @@ export default class coinbasepro extends coinbaseproRest {
|
|
|
124
124
|
async watchTickers(symbols = undefined, params = {}) {
|
|
125
125
|
/**
|
|
126
126
|
* @method
|
|
127
|
-
* @name
|
|
128
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-tickers-channel
|
|
127
|
+
* @name coinbasepro#watchTickers
|
|
129
128
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
130
129
|
* @param {string[]} [symbols] unified symbol of the market to fetch the ticker for
|
|
131
130
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
package/js/src/pro/cryptocom.js
CHANGED
|
@@ -92,13 +92,19 @@ export default class cryptocom extends cryptocomRest {
|
|
|
92
92
|
await this.loadMarkets();
|
|
93
93
|
symbols = this.marketSymbols(symbols);
|
|
94
94
|
const topics = [];
|
|
95
|
+
const messageHashes = [];
|
|
96
|
+
if (!limit) {
|
|
97
|
+
limit = 150;
|
|
98
|
+
}
|
|
95
99
|
for (let i = 0; i < symbols.length; i++) {
|
|
96
100
|
const symbol = symbols[i];
|
|
97
101
|
const market = this.market(symbol);
|
|
98
|
-
const currentTopic = 'book' + '.' + market['id'];
|
|
102
|
+
const currentTopic = 'book' + '.' + market['id'] + '.' + limit;
|
|
103
|
+
const messageHash = 'orderbook:' + market['symbol'];
|
|
104
|
+
messageHashes.push(messageHash);
|
|
99
105
|
topics.push(currentTopic);
|
|
100
106
|
}
|
|
101
|
-
const orderbook = await this.watchPublicMultiple(
|
|
107
|
+
const orderbook = await this.watchPublicMultiple(messageHashes, topics, params);
|
|
102
108
|
return orderbook.limit();
|
|
103
109
|
}
|
|
104
110
|
handleOrderBookSnapshot(client, message) {
|
|
@@ -123,7 +129,6 @@ export default class cryptocom extends cryptocomRest {
|
|
|
123
129
|
// ]
|
|
124
130
|
// }
|
|
125
131
|
//
|
|
126
|
-
const messageHash = this.safeString(message, 'subscription');
|
|
127
132
|
const marketId = this.safeString(message, 'instrument_name');
|
|
128
133
|
const market = this.safeMarket(marketId);
|
|
129
134
|
const symbol = market['symbol'];
|
|
@@ -139,6 +144,7 @@ export default class cryptocom extends cryptocomRest {
|
|
|
139
144
|
}
|
|
140
145
|
orderbook.reset(snapshot);
|
|
141
146
|
this.orderbooks[symbol] = orderbook;
|
|
147
|
+
const messageHash = 'orderbook:' + symbol;
|
|
142
148
|
client.resolve(orderbook, messageHash);
|
|
143
149
|
}
|
|
144
150
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
package/js/src/pro/poloniex.js
CHANGED
|
@@ -542,7 +542,8 @@ export default class poloniex extends poloniexRest {
|
|
|
542
542
|
const marketId = this.safeString(data, 'symbol');
|
|
543
543
|
const symbol = this.safeSymbol(marketId);
|
|
544
544
|
const market = this.safeMarket(symbol);
|
|
545
|
-
const
|
|
545
|
+
const timeframes = this.safeValue(this.options, 'timeframes', {});
|
|
546
|
+
const timeframe = this.findTimeframe(channel, timeframes);
|
|
546
547
|
const messageHash = channel + '::' + symbol;
|
|
547
548
|
const parsed = this.parseWsOHLCV(data, market);
|
|
548
549
|
this.ohlcvs[symbol] = this.safeValue(this.ohlcvs, symbol, {});
|
package/package.json
CHANGED