ccxt 4.5.22 → 4.5.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +6 -1
- package/dist/cjs/src/abstract/bullish.js +11 -0
- package/dist/cjs/src/base/Exchange.js +3 -2
- package/dist/cjs/src/base/ws/WsClient.js +15 -0
- package/dist/cjs/src/binance.js +159 -36
- package/dist/cjs/src/bingx.js +2 -1
- package/dist/cjs/src/bitmart.js +1 -0
- package/dist/cjs/src/bullish.js +2919 -0
- package/dist/cjs/src/bybit.js +34 -37
- package/dist/cjs/src/gate.js +2 -2
- package/dist/cjs/src/htx.js +4 -1
- package/dist/cjs/src/hyperliquid.js +115 -12
- package/dist/cjs/src/kucoin.js +22 -3
- package/dist/cjs/src/mexc.js +7 -0
- package/dist/cjs/src/okx.js +117 -63
- package/dist/cjs/src/paradex.js +78 -3
- package/dist/cjs/src/pro/binance.js +131 -29
- package/dist/cjs/src/pro/bullish.js +781 -0
- package/dist/cjs/src/pro/coinbase.js +2 -2
- package/dist/cjs/src/pro/hyperliquid.js +75 -15
- package/dist/cjs/src/pro/upbit.js +28 -82
- package/js/ccxt.d.ts +8 -2
- package/js/ccxt.js +6 -2
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/abstract/bingx.d.ts +1 -0
- package/js/src/abstract/bullish.d.ts +65 -0
- package/js/src/abstract/bullish.js +5 -0
- package/js/src/abstract/kucoin.d.ts +15 -0
- package/js/src/abstract/kucoinfutures.d.ts +15 -0
- package/js/src/abstract/mexc.d.ts +7 -0
- package/js/src/abstract/myokx.d.ts +90 -39
- package/js/src/abstract/okx.d.ts +90 -39
- package/js/src/abstract/okxus.d.ts +90 -39
- package/js/src/base/Exchange.d.ts +1 -1
- package/js/src/base/Exchange.js +3 -2
- package/js/src/base/ws/Client.d.ts +1 -0
- package/js/src/base/ws/WsClient.js +15 -0
- package/js/src/binance.d.ts +14 -5
- package/js/src/binance.js +159 -36
- package/js/src/bingx.js +2 -1
- package/js/src/bitmart.js +1 -0
- package/js/src/bullish.d.ts +446 -0
- package/js/src/bullish.js +2912 -0
- package/js/src/bybit.js +34 -37
- package/js/src/gate.js +2 -2
- package/js/src/htx.js +4 -1
- package/js/src/hyperliquid.d.ts +24 -0
- package/js/src/hyperliquid.js +115 -12
- package/js/src/kucoin.js +22 -3
- package/js/src/mexc.js +7 -0
- package/js/src/okx.js +117 -63
- package/js/src/paradex.d.ts +15 -1
- package/js/src/paradex.js +78 -3
- package/js/src/pro/binance.d.ts +7 -0
- package/js/src/pro/binance.js +131 -29
- package/js/src/pro/bullish.d.ts +108 -0
- package/js/src/pro/bullish.js +774 -0
- package/js/src/pro/coinbase.js +2 -2
- package/js/src/pro/hyperliquid.d.ts +13 -1
- package/js/src/pro/hyperliquid.js +75 -15
- package/js/src/pro/upbit.d.ts +0 -1
- package/js/src/pro/upbit.js +28 -82
- package/package.json +2 -2
package/js/src/pro/binance.js
CHANGED
|
@@ -575,6 +575,7 @@ export default class binance extends binanceRest {
|
|
|
575
575
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#diff-depth-stream
|
|
576
576
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Partial-Book-Depth-Streams
|
|
577
577
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Diff-Book-Depth-Streams
|
|
578
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Diff-Book-Depth-Streams-RPI
|
|
578
579
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Partial-Book-Depth-Streams
|
|
579
580
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Diff-Book-Depth-Streams
|
|
580
581
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
@@ -630,11 +631,13 @@ export default class binance extends binanceRest {
|
|
|
630
631
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#diff-depth-stream
|
|
631
632
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Partial-Book-Depth-Streams
|
|
632
633
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Diff-Book-Depth-Streams
|
|
634
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Diff-Book-Depth-Streams-RPI
|
|
633
635
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Partial-Book-Depth-Streams
|
|
634
636
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/Diff-Book-Depth-Streams
|
|
635
637
|
* @param {string[]} symbols unified array of symbols
|
|
636
638
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
637
639
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
640
|
+
* @param {boolean} [params.rpi] *future only* set to true to use the RPI endpoint
|
|
638
641
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
639
642
|
*/
|
|
640
643
|
async watchOrderBookForSymbols(symbols, limit = undefined, params = {}) {
|
|
@@ -645,7 +648,7 @@ export default class binance extends binanceRest {
|
|
|
645
648
|
if (firstMarket['contract']) {
|
|
646
649
|
type = firstMarket['linear'] ? 'future' : 'delivery';
|
|
647
650
|
}
|
|
648
|
-
|
|
651
|
+
let name = 'depth';
|
|
649
652
|
let streamHash = 'multipleOrderbook';
|
|
650
653
|
if (symbols !== undefined) {
|
|
651
654
|
const symbolsLength = symbols.length;
|
|
@@ -654,7 +657,14 @@ export default class binance extends binanceRest {
|
|
|
654
657
|
}
|
|
655
658
|
streamHash += '::' + symbols.join(',');
|
|
656
659
|
}
|
|
657
|
-
|
|
660
|
+
let watchOrderBookRate = undefined;
|
|
661
|
+
[watchOrderBookRate, params] = this.handleOptionAndParams(params, 'watchOrderBookForSymbols', 'watchOrderBookRate', '100');
|
|
662
|
+
let rpi = undefined;
|
|
663
|
+
[rpi, params] = this.handleOptionAndParams(params, 'watchOrderBookForSymbols', 'rpi', false);
|
|
664
|
+
if (rpi && type === 'future') {
|
|
665
|
+
name = 'rpiDepth';
|
|
666
|
+
watchOrderBookRate = '500';
|
|
667
|
+
}
|
|
658
668
|
const subParams = [];
|
|
659
669
|
const messageHashes = [];
|
|
660
670
|
for (let i = 0; i < symbols.length; i++) {
|
|
@@ -662,7 +672,7 @@ export default class binance extends binanceRest {
|
|
|
662
672
|
const market = this.market(symbol);
|
|
663
673
|
messageHashes.push('orderbook::' + symbol);
|
|
664
674
|
const subscriptionHash = market['lowercaseId'] + '@' + name;
|
|
665
|
-
const symbolHash = subscriptionHash + '@' + watchOrderBookRate + 'ms';
|
|
675
|
+
const symbolHash = subscriptionHash + '@' + watchOrderBookRate.toString() + 'ms';
|
|
666
676
|
subParams.push(symbolHash);
|
|
667
677
|
}
|
|
668
678
|
const messageHashesLength = messageHashes.length;
|
|
@@ -2987,6 +2997,7 @@ export default class binance extends binanceRest {
|
|
|
2987
2997
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#place-new-order-trade
|
|
2988
2998
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/New-Order
|
|
2989
2999
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api
|
|
3000
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/New-Algo-Order
|
|
2990
3001
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2991
3002
|
* @param {string} type 'market' or 'limit'
|
|
2992
3003
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -3009,12 +3020,25 @@ export default class binance extends binanceRest {
|
|
|
3009
3020
|
const messageHash = requestId.toString();
|
|
3010
3021
|
const sor = this.safeBool2(params, 'sor', 'SOR', false);
|
|
3011
3022
|
params = this.omit(params, 'sor', 'SOR');
|
|
3023
|
+
const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
3024
|
+
const stopLossPrice = this.safeString(params, 'stopLossPrice', triggerPrice);
|
|
3025
|
+
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
3026
|
+
const trailingDelta = this.safeString(params, 'trailingDelta');
|
|
3027
|
+
const trailingPercent = this.safeStringN(params, ['trailingPercent', 'callbackRate', 'trailingDelta']);
|
|
3028
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
3029
|
+
const isStopLoss = stopLossPrice !== undefined || trailingDelta !== undefined;
|
|
3030
|
+
const isTakeProfit = takeProfitPrice !== undefined;
|
|
3031
|
+
const isTriggerOrder = triggerPrice !== undefined;
|
|
3032
|
+
const isConditional = isTriggerOrder || isTrailingPercentOrder || isStopLoss || isTakeProfit;
|
|
3012
3033
|
const payload = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
3013
3034
|
let returnRateLimits = false;
|
|
3014
3035
|
[returnRateLimits, params] = this.handleOptionAndParams(params, 'createOrderWs', 'returnRateLimits', false);
|
|
3015
3036
|
payload['returnRateLimits'] = returnRateLimits;
|
|
3016
3037
|
const test = this.safeBool(params, 'test', false);
|
|
3017
3038
|
params = this.omit(params, 'test');
|
|
3039
|
+
if (market['linear'] && market['swap'] && isConditional) {
|
|
3040
|
+
payload['algoType'] = 'CONDITIONAL';
|
|
3041
|
+
}
|
|
3018
3042
|
const message = {
|
|
3019
3043
|
'id': messageHash,
|
|
3020
3044
|
'method': 'order.place',
|
|
@@ -3028,6 +3052,9 @@ export default class binance extends binanceRest {
|
|
|
3028
3052
|
message['method'] = 'order.test';
|
|
3029
3053
|
}
|
|
3030
3054
|
}
|
|
3055
|
+
if (market['linear'] && market['swap'] && isConditional) {
|
|
3056
|
+
message['method'] = 'algoOrder.place';
|
|
3057
|
+
}
|
|
3031
3058
|
const subscription = {
|
|
3032
3059
|
'method': this.handleOrderWs,
|
|
3033
3060
|
};
|
|
@@ -3294,10 +3321,12 @@ export default class binance extends binanceRest {
|
|
|
3294
3321
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/trading-requests#cancel-order-trade
|
|
3295
3322
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Cancel-Order
|
|
3296
3323
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Cancel-Order
|
|
3324
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Cancel-Algo-Order
|
|
3297
3325
|
* @param {string} id order id
|
|
3298
3326
|
* @param {string} [symbol] unified market symbol, default is undefined
|
|
3299
3327
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3300
3328
|
* @param {string|undefined} [params.cancelRestrictions] Supported values: ONLY_NEW - Cancel will succeed if the order status is NEW. ONLY_PARTIALLY_FILLED - Cancel will succeed if order status is PARTIALLY_FILLED.
|
|
3329
|
+
* @param {boolean} [params.trigger] set to true if you would like to cancel a conditional order
|
|
3301
3330
|
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3302
3331
|
*/
|
|
3303
3332
|
async cancelOrderWs(id, symbol = undefined, params = {}) {
|
|
@@ -3316,19 +3345,34 @@ export default class binance extends binanceRest {
|
|
|
3316
3345
|
'symbol': this.marketId(symbol),
|
|
3317
3346
|
'returnRateLimits': returnRateLimits,
|
|
3318
3347
|
};
|
|
3319
|
-
const
|
|
3348
|
+
const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
|
|
3349
|
+
const clientOrderId = this.safeStringN(params, ['clientAlgoId', 'origClientOrderId', 'clientOrderId']);
|
|
3350
|
+
const shouldUseAlgoOrder = market['linear'] && market['swap'] && isConditional;
|
|
3320
3351
|
if (clientOrderId !== undefined) {
|
|
3321
|
-
|
|
3352
|
+
if (shouldUseAlgoOrder) {
|
|
3353
|
+
payload['clientAlgoId'] = clientOrderId;
|
|
3354
|
+
}
|
|
3355
|
+
else {
|
|
3356
|
+
payload['origClientOrderId'] = clientOrderId;
|
|
3357
|
+
}
|
|
3322
3358
|
}
|
|
3323
3359
|
else {
|
|
3324
|
-
|
|
3360
|
+
if (shouldUseAlgoOrder) {
|
|
3361
|
+
payload['algoId'] = this.numberToString(id);
|
|
3362
|
+
}
|
|
3363
|
+
else {
|
|
3364
|
+
payload['orderId'] = this.numberToString(id);
|
|
3365
|
+
}
|
|
3325
3366
|
}
|
|
3326
|
-
params = this.omit(params, ['origClientOrderId', 'clientOrderId']);
|
|
3367
|
+
params = this.omit(params, ['origClientOrderId', 'clientOrderId', 'stop', 'trigger', 'conditional']);
|
|
3327
3368
|
const message = {
|
|
3328
3369
|
'id': messageHash,
|
|
3329
3370
|
'method': 'order.cancel',
|
|
3330
3371
|
'params': this.signParams(this.extend(payload, params)),
|
|
3331
3372
|
};
|
|
3373
|
+
if (shouldUseAlgoOrder) {
|
|
3374
|
+
message['method'] = 'algoOrder.cancel';
|
|
3375
|
+
}
|
|
3332
3376
|
const subscription = {
|
|
3333
3377
|
'method': this.handleOrderWs,
|
|
3334
3378
|
};
|
|
@@ -3405,7 +3449,7 @@ export default class binance extends binanceRest {
|
|
|
3405
3449
|
payload['origClientOrderId'] = clientOrderId;
|
|
3406
3450
|
}
|
|
3407
3451
|
else {
|
|
3408
|
-
payload['orderId'] = this.
|
|
3452
|
+
payload['orderId'] = this.numberToString(id);
|
|
3409
3453
|
}
|
|
3410
3454
|
const message = {
|
|
3411
3455
|
'id': messageHash,
|
|
@@ -3531,6 +3575,7 @@ export default class binance extends binanceRest {
|
|
|
3531
3575
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/user-data-stream#order-update
|
|
3532
3576
|
* @see https://developers.binance.com/docs/margin_trading/trade-data-stream/Event-Order-Update
|
|
3533
3577
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/user-data-streams/Event-Order-Update
|
|
3578
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/user-data-streams/Event-Algo-Order-Update
|
|
3534
3579
|
* @param {string} symbol unified market symbol of the market the orders were made in
|
|
3535
3580
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
3536
3581
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -3666,8 +3711,37 @@ export default class binance extends binanceRest {
|
|
|
3666
3711
|
// "rp":"0" // Realized Profit of the trade
|
|
3667
3712
|
// }
|
|
3668
3713
|
//
|
|
3714
|
+
// watchOrders: linear swap trigger order
|
|
3715
|
+
//
|
|
3716
|
+
// {
|
|
3717
|
+
// "caid":"Q5xaq5EGKgXXa0fD7fs0Ip", // Client Algo Id
|
|
3718
|
+
// "aid":2148719, // Algo Id
|
|
3719
|
+
// "at":"CONDITIONAL", // Algo Type
|
|
3720
|
+
// "o":"TAKE_PROFIT", // Order Type
|
|
3721
|
+
// "s":"BNBUSDT", // Symbol
|
|
3722
|
+
// "S":"SELL", // Side
|
|
3723
|
+
// "ps":"BOTH", // Position Side
|
|
3724
|
+
// "f":"GTC", // Time in force
|
|
3725
|
+
// "q":"0.01", // quantity
|
|
3726
|
+
// "X":"CANCELED", // Algo status
|
|
3727
|
+
// "ai":"", // order id
|
|
3728
|
+
// "ap": "0.00000", // avg fill price in matching engine, only display when order is triggered and placed in matching engine
|
|
3729
|
+
// "aq": "0.00000", // execuated quantity in matching engine, only display when order is triggered and placed in matching engine
|
|
3730
|
+
// "act": "0", // actual order type in matching engine, only display when order is triggered and placed in matching engine
|
|
3731
|
+
// "tp":"750", // Trigger price
|
|
3732
|
+
// "p":"750", // Order Price
|
|
3733
|
+
// "V":"EXPIRE_MAKER", // STP mode
|
|
3734
|
+
// "wt":"CONTRACT_PRICE", // Working type
|
|
3735
|
+
// "pm":"NONE", // Price match mode
|
|
3736
|
+
// "cp":false, // If Close-All
|
|
3737
|
+
// "pP":false, // If price protection is turned on
|
|
3738
|
+
// "R":false, // Is this reduce only
|
|
3739
|
+
// "tt":0, // Trigger time
|
|
3740
|
+
// "gtd":0, // good till time for GTD time in force
|
|
3741
|
+
// "rm": "Reduce Only reject" // algo order failed reason
|
|
3742
|
+
// }
|
|
3743
|
+
//
|
|
3669
3744
|
const executionType = this.safeString(order, 'x');
|
|
3670
|
-
const orderId = this.safeString(order, 'i');
|
|
3671
3745
|
const marketId = this.safeString(order, 's');
|
|
3672
3746
|
const marketType = ('ps' in order) ? 'contract' : 'spot';
|
|
3673
3747
|
const symbol = this.safeSymbol(marketId, undefined, undefined, marketType);
|
|
@@ -3693,21 +3767,13 @@ export default class binance extends binanceRest {
|
|
|
3693
3767
|
'currency': feeCurrency,
|
|
3694
3768
|
};
|
|
3695
3769
|
}
|
|
3696
|
-
const price = this.safeString(order, 'p');
|
|
3697
|
-
const amount = this.safeString(order, 'q');
|
|
3698
|
-
const side = this.safeStringLower(order, 'S');
|
|
3699
|
-
const type = this.safeStringLower(order, 'o');
|
|
3700
|
-
const filled = this.safeString(order, 'z');
|
|
3701
|
-
const cost = this.safeString(order, 'Z');
|
|
3702
|
-
const average = this.safeString(order, 'ap');
|
|
3703
3770
|
const rawStatus = this.safeString(order, 'X');
|
|
3704
3771
|
const status = this.parseOrderStatus(rawStatus);
|
|
3705
|
-
|
|
3706
|
-
let clientOrderId = this.safeString(order, 'C');
|
|
3772
|
+
let clientOrderId = this.safeString2(order, 'C', 'caid');
|
|
3707
3773
|
if ((clientOrderId === undefined) || (clientOrderId.length === 0)) {
|
|
3708
3774
|
clientOrderId = this.safeString(order, 'c');
|
|
3709
3775
|
}
|
|
3710
|
-
const stopPrice = this.
|
|
3776
|
+
const stopPrice = this.safeStringN(order, ['P', 'sp', 'tp']);
|
|
3711
3777
|
let timeInForce = this.safeString(order, 'f');
|
|
3712
3778
|
if (timeInForce === 'GTX') {
|
|
3713
3779
|
// GTX means "Good Till Crossing" and is an equivalent way of saying Post Only
|
|
@@ -3716,28 +3782,28 @@ export default class binance extends binanceRest {
|
|
|
3716
3782
|
return this.safeOrder({
|
|
3717
3783
|
'info': order,
|
|
3718
3784
|
'symbol': symbol,
|
|
3719
|
-
'id':
|
|
3785
|
+
'id': this.safeString2(order, 'i', 'aid'),
|
|
3720
3786
|
'clientOrderId': clientOrderId,
|
|
3721
3787
|
'timestamp': timestamp,
|
|
3722
3788
|
'datetime': this.iso8601(timestamp),
|
|
3723
3789
|
'lastTradeTimestamp': lastTradeTimestamp,
|
|
3724
3790
|
'lastUpdateTimestamp': lastUpdateTimestamp,
|
|
3725
|
-
'type':
|
|
3791
|
+
'type': this.safeStringLower(order, 'o'),
|
|
3726
3792
|
'timeInForce': timeInForce,
|
|
3727
3793
|
'postOnly': undefined,
|
|
3728
3794
|
'reduceOnly': this.safeBool(order, 'R'),
|
|
3729
|
-
'side':
|
|
3730
|
-
'price':
|
|
3795
|
+
'side': this.safeStringLower(order, 'S'),
|
|
3796
|
+
'price': this.safeString(order, 'p'),
|
|
3731
3797
|
'stopPrice': stopPrice,
|
|
3732
3798
|
'triggerPrice': stopPrice,
|
|
3733
|
-
'amount':
|
|
3734
|
-
'cost':
|
|
3735
|
-
'average':
|
|
3736
|
-
'filled':
|
|
3799
|
+
'amount': this.safeString(order, 'q'),
|
|
3800
|
+
'cost': this.safeString(order, 'Z'),
|
|
3801
|
+
'average': this.safeString(order, 'ap'),
|
|
3802
|
+
'filled': this.safeString(order, 'z'),
|
|
3737
3803
|
'remaining': undefined,
|
|
3738
3804
|
'status': status,
|
|
3739
3805
|
'fee': fee,
|
|
3740
|
-
'trades':
|
|
3806
|
+
'trades': undefined,
|
|
3741
3807
|
});
|
|
3742
3808
|
}
|
|
3743
3809
|
handleOrderUpdate(client, message) {
|
|
@@ -3822,8 +3888,43 @@ export default class binance extends binanceRest {
|
|
|
3822
3888
|
// }
|
|
3823
3889
|
// }
|
|
3824
3890
|
//
|
|
3891
|
+
// linear swap conditional
|
|
3892
|
+
//
|
|
3893
|
+
// {
|
|
3894
|
+
// "e":"ALGO_UPDATE", // Event Type
|
|
3895
|
+
// "T":1750515742297, // Event Time
|
|
3896
|
+
// "E":1750515742303, // Transaction Time
|
|
3897
|
+
// "o":{
|
|
3898
|
+
// "caid":"Q5xaq5EGKgXXa0fD7fs0Ip", // Client Algo Id
|
|
3899
|
+
// "aid":2148719, // Algo Id
|
|
3900
|
+
// "at":"CONDITIONAL", // Algo Type
|
|
3901
|
+
// "o":"TAKE_PROFIT", // Order Type
|
|
3902
|
+
// "s":"BNBUSDT", // Symbol
|
|
3903
|
+
// "S":"SELL", // Side
|
|
3904
|
+
// "ps":"BOTH", // Position Side
|
|
3905
|
+
// "f":"GTC", // Time in force
|
|
3906
|
+
// "q":"0.01", // quantity
|
|
3907
|
+
// "X":"CANCELED", // Algo status
|
|
3908
|
+
// "ai":"", // order id
|
|
3909
|
+
// "ap": "0.00000", // avg fill price in matching engine, only display when order is triggered and placed in matching engine
|
|
3910
|
+
// "aq": "0.00000", // execuated quantity in matching engine, only display when order is triggered and placed in matching engine
|
|
3911
|
+
// "act": "0", // actual order type in matching engine, only display when order is triggered and placed in matching engine
|
|
3912
|
+
// "tp":"750", // Trigger price
|
|
3913
|
+
// "p":"750", // Order Price
|
|
3914
|
+
// "V":"EXPIRE_MAKER", // STP mode
|
|
3915
|
+
// "wt":"CONTRACT_PRICE", // Working type
|
|
3916
|
+
// "pm":"NONE", // Price match mode
|
|
3917
|
+
// "cp":false, // If Close-All
|
|
3918
|
+
// "pP":false, // If price protection is turned on
|
|
3919
|
+
// "R":false, // Is this reduce only
|
|
3920
|
+
// "tt":0, // Trigger time
|
|
3921
|
+
// "gtd":0, // good till time for GTD time in force
|
|
3922
|
+
// "rm": "Reduce Only reject" // algo order failed reason
|
|
3923
|
+
// }
|
|
3924
|
+
// }
|
|
3925
|
+
//
|
|
3825
3926
|
const e = this.safeString(message, 'e');
|
|
3826
|
-
if (e === 'ORDER_TRADE_UPDATE') {
|
|
3927
|
+
if ((e === 'ORDER_TRADE_UPDATE') || (e === 'ALGO_UPDATE')) {
|
|
3827
3928
|
message = this.safeDict(message, 'o', message);
|
|
3828
3929
|
}
|
|
3829
3930
|
this.handleMyTrade(client, message);
|
|
@@ -4479,6 +4580,7 @@ export default class binance extends binanceRest {
|
|
|
4479
4580
|
'ACCOUNT_UPDATE': this.handleAcountUpdate,
|
|
4480
4581
|
'executionReport': this.handleOrderUpdate,
|
|
4481
4582
|
'ORDER_TRADE_UPDATE': this.handleOrderUpdate,
|
|
4583
|
+
'ALGO_UPDATE': this.handleOrderUpdate,
|
|
4482
4584
|
'forceOrder': this.handleLiquidation,
|
|
4483
4585
|
'eventStreamTerminated': this.handleEventStreamTerminated,
|
|
4484
4586
|
'externalLockUpdate': this.handleBalance,
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import bullishRest from '../bullish.js';
|
|
2
|
+
import type { Balances, Int, Order, OrderBook, Position, Str, Strings, Ticker, Trade } from '../base/types.js';
|
|
3
|
+
import Client from '../base/ws/Client.js';
|
|
4
|
+
export default class bullish extends bullishRest {
|
|
5
|
+
describe(): any;
|
|
6
|
+
requestId(): any;
|
|
7
|
+
ping(client: Client): {
|
|
8
|
+
jsonrpc: string;
|
|
9
|
+
type: string;
|
|
10
|
+
method: string;
|
|
11
|
+
params: {};
|
|
12
|
+
id: any;
|
|
13
|
+
};
|
|
14
|
+
handlePong(client: Client, message: any): any;
|
|
15
|
+
watchPublic(url: string, messageHash: string, request?: {}, params?: {}): Promise<any>;
|
|
16
|
+
watchPrivate(messageHash: string, subscribeHash: string, request?: {}, params?: {}): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* @method
|
|
19
|
+
* @name bullish#watchTrades
|
|
20
|
+
* @description get the list of most recent trades for a particular symbol
|
|
21
|
+
* @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#overview--unified-anonymous-trades-websocket-unauthenticated
|
|
22
|
+
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
23
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
24
|
+
* @param {int} [limit] the maximum amount of trades to fetch
|
|
25
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
26
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
27
|
+
*/
|
|
28
|
+
watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
29
|
+
handleTrades(client: Client, message: any): void;
|
|
30
|
+
/**
|
|
31
|
+
* @method
|
|
32
|
+
* @name bullish#watchTicker
|
|
33
|
+
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
34
|
+
* @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#overview--anonymous-market-data-price-tick-unauthenticated
|
|
35
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
36
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
37
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
38
|
+
*/
|
|
39
|
+
watchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
40
|
+
handleTicker(client: Client, message: any): void;
|
|
41
|
+
/**
|
|
42
|
+
* @method
|
|
43
|
+
* @name bullish#watchOrderBook
|
|
44
|
+
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
45
|
+
* @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#overview--multi-orderbook-websocket-unauthenticated
|
|
46
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
47
|
+
* @param {int} [limit] the maximum amount of order book entries to return
|
|
48
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
49
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
50
|
+
*/
|
|
51
|
+
watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
52
|
+
handleOrderBook(client: Client, message: any): void;
|
|
53
|
+
separateBidsOrAsks(entry: any): any[];
|
|
54
|
+
/**
|
|
55
|
+
* @method
|
|
56
|
+
* @name bullish#watchOrders
|
|
57
|
+
* @description watches information on multiple orders made by the user
|
|
58
|
+
* @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#overview--private-data-websocket-authenticated
|
|
59
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
60
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
61
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
62
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
63
|
+
* @param {string} [params.tradingAccountId] the trading account id to fetch entries for
|
|
64
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
65
|
+
*/
|
|
66
|
+
watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
67
|
+
handleOrders(client: Client, message: any): void;
|
|
68
|
+
/**
|
|
69
|
+
* @method
|
|
70
|
+
* @name bullish#watchMyTrades
|
|
71
|
+
* @description watches information on multiple trades made by the user
|
|
72
|
+
* @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#overview--private-data-websocket-authenticated
|
|
73
|
+
* @param {string} symbol unified market symbol of the market trades were made in
|
|
74
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
75
|
+
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
76
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
77
|
+
* @param {string} [params.tradingAccountId] the trading account id to fetch entries for
|
|
78
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
79
|
+
*/
|
|
80
|
+
watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
81
|
+
handleMyTrades(client: Client, message: any): void;
|
|
82
|
+
/**
|
|
83
|
+
* @method
|
|
84
|
+
* @name bullish#watchBalance
|
|
85
|
+
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
86
|
+
* @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#overview--private-data-websocket-authenticated
|
|
87
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
88
|
+
* @param {string} [params.tradingAccountId] the trading account id to fetch entries for
|
|
89
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
90
|
+
*/
|
|
91
|
+
watchBalance(params?: {}): Promise<Balances>;
|
|
92
|
+
handleBalance(client: Client, message: any): void;
|
|
93
|
+
/**
|
|
94
|
+
* @method
|
|
95
|
+
* @name bullish#watchPositions
|
|
96
|
+
* @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#overview--private-data-websocket-authenticated
|
|
97
|
+
* @description watch all open positions
|
|
98
|
+
* @param {string[]} [symbols] list of unified market symbols
|
|
99
|
+
* @param {int} [since] the earliest time in ms to fetch positions for
|
|
100
|
+
* @param {int} [limit] the maximum number of positions to retrieve
|
|
101
|
+
* @param {object} params extra parameters specific to the exchange API endpoint
|
|
102
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
|
|
103
|
+
*/
|
|
104
|
+
watchPositions(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
|
|
105
|
+
handlePositions(client: Client, message: any): void;
|
|
106
|
+
handleErrorMessage(client: Client, message: any): void;
|
|
107
|
+
handleMessage(client: Client, message: any): void;
|
|
108
|
+
}
|