ccxt 4.2.7 → 4.2.8
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/dist/ccxt.browser.js +115 -30
- 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/bybit.js +23 -3
- package/dist/cjs/src/okx.js +46 -15
- 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/bybit.js +23 -3
- package/js/src/okx.js +46 -15
- 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/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/package.json +1 -1
package/js/src/bybit.js
CHANGED
|
@@ -3502,6 +3502,7 @@ export default class bybit extends Exchange {
|
|
|
3502
3502
|
* @name bybit#createOrder
|
|
3503
3503
|
* @description create a trade order
|
|
3504
3504
|
* @see https://bybit-exchange.github.io/docs/v5/order/create-order
|
|
3505
|
+
* @see https://bybit-exchange.github.io/docs/v5/position/trading-stop
|
|
3505
3506
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
3506
3507
|
* @param {string} type 'market' or 'limit'
|
|
3507
3508
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -3523,6 +3524,8 @@ export default class bybit extends Exchange {
|
|
|
3523
3524
|
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
3524
3525
|
* @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
|
|
3525
3526
|
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
|
|
3527
|
+
* @param {string} [params.trailingAmount] the quote amount to trail away from the current market price
|
|
3528
|
+
* @param {string} [params.trailingTriggerPrice] the price to trigger a trailing order, default uses the price argument
|
|
3526
3529
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3527
3530
|
*/
|
|
3528
3531
|
await this.loadMarkets();
|
|
@@ -3533,8 +3536,16 @@ export default class bybit extends Exchange {
|
|
|
3533
3536
|
if (isUsdcSettled && !isUnifiedAccount) {
|
|
3534
3537
|
return await this.createUsdcOrder(symbol, type, side, amount, price, params);
|
|
3535
3538
|
}
|
|
3539
|
+
const trailingAmount = this.safeString2(params, 'trailingAmount', 'trailingStop');
|
|
3540
|
+
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
3536
3541
|
const orderRequest = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
3537
|
-
|
|
3542
|
+
let response = undefined;
|
|
3543
|
+
if (isTrailingAmountOrder) {
|
|
3544
|
+
response = await this.privatePostV5PositionTradingStop(orderRequest);
|
|
3545
|
+
}
|
|
3546
|
+
else {
|
|
3547
|
+
response = await this.privatePostV5OrderCreate(orderRequest); // already extended inside createOrderRequest
|
|
3548
|
+
}
|
|
3538
3549
|
//
|
|
3539
3550
|
// {
|
|
3540
3551
|
// "retCode": 0,
|
|
@@ -3644,12 +3655,21 @@ export default class bybit extends Exchange {
|
|
|
3644
3655
|
const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
|
|
3645
3656
|
const stopLoss = this.safeValue(params, 'stopLoss');
|
|
3646
3657
|
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
3658
|
+
const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activePrice', price);
|
|
3659
|
+
const trailingAmount = this.safeString2(params, 'trailingAmount', 'trailingStop');
|
|
3660
|
+
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
3647
3661
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
3648
3662
|
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
3649
3663
|
const isStopLoss = stopLoss !== undefined;
|
|
3650
3664
|
const isTakeProfit = takeProfit !== undefined;
|
|
3651
3665
|
const isBuy = side === 'buy';
|
|
3652
|
-
if (
|
|
3666
|
+
if (isTrailingAmountOrder) {
|
|
3667
|
+
if (trailingTriggerPrice !== undefined) {
|
|
3668
|
+
request['activePrice'] = this.priceToPrecision(symbol, trailingTriggerPrice);
|
|
3669
|
+
}
|
|
3670
|
+
request['trailingStop'] = trailingAmount;
|
|
3671
|
+
}
|
|
3672
|
+
else if (triggerPrice !== undefined) {
|
|
3653
3673
|
const triggerDirection = this.safeString(params, 'triggerDirection');
|
|
3654
3674
|
params = this.omit(params, ['triggerPrice', 'stopPrice', 'triggerDirection']);
|
|
3655
3675
|
if (market['spot']) {
|
|
@@ -3704,7 +3724,7 @@ export default class bybit extends Exchange {
|
|
|
3704
3724
|
// mandatory field for options
|
|
3705
3725
|
request['orderLinkId'] = this.uuid16();
|
|
3706
3726
|
}
|
|
3707
|
-
params = this.omit(params, ['stopPrice', 'timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'clientOrderId', 'triggerPrice', 'stopLoss', 'takeProfit']);
|
|
3727
|
+
params = this.omit(params, ['stopPrice', 'timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'clientOrderId', 'triggerPrice', 'stopLoss', 'takeProfit', 'trailingAmount', 'trailingTriggerPrice']);
|
|
3708
3728
|
return this.extend(request, params);
|
|
3709
3729
|
}
|
|
3710
3730
|
async createOrders(orders, params = {}) {
|
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));
|
|
@@ -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, {});
|
|
@@ -15,7 +15,7 @@ export declare class BigInteger {
|
|
|
15
15
|
protected intValue(): number;
|
|
16
16
|
protected byteValue(): number;
|
|
17
17
|
protected shortValue(): number;
|
|
18
|
-
protected signum():
|
|
18
|
+
protected signum(): 0 | 1 | -1;
|
|
19
19
|
toByteArray(): number[];
|
|
20
20
|
protected equals(a: BigInteger): boolean;
|
|
21
21
|
protected min(a: BigInteger): BigInteger;
|
package/package.json
CHANGED