ccxt 4.5.9 → 4.5.11
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 +5 -6
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -6
- package/dist/cjs/src/base/Exchange.js +14 -2
- package/dist/cjs/src/bingx.js +1 -1
- package/dist/cjs/src/bitfinex.js +4 -2
- package/dist/cjs/src/bitget.js +5 -2
- package/dist/cjs/src/btcmarkets.js +4 -2
- package/dist/cjs/src/coinbase.js +1 -0
- package/dist/cjs/src/deribit.js +21 -19
- package/dist/cjs/src/kraken.js +4 -0
- package/dist/cjs/src/kucoin.js +1 -1
- package/dist/cjs/src/latoken.js +1 -0
- package/dist/cjs/src/mexc.js +1 -0
- package/dist/cjs/src/onetrading.js +2 -1
- package/dist/cjs/src/phemex.js +1 -0
- package/dist/cjs/src/pro/bitget.js +1 -0
- package/dist/cjs/src/pro/htx.js +22 -3
- package/dist/cjs/src/pro/kraken.js +282 -458
- package/dist/cjs/src/pro/mexc.js +15 -10
- package/dist/cjs/src/probit.js +1 -1
- package/js/ccxt.d.ts +2 -8
- package/js/ccxt.js +2 -6
- package/js/src/abstract/coinbase.d.ts +1 -0
- package/js/src/abstract/coinbaseadvanced.d.ts +1 -0
- package/js/src/abstract/phemex.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +5 -2
- package/js/src/base/Exchange.js +14 -2
- package/js/src/bingx.js +1 -1
- package/js/src/bitfinex.d.ts +1 -1
- package/js/src/bitfinex.js +4 -2
- package/js/src/bitget.d.ts +1 -1
- package/js/src/bitget.js +5 -2
- package/js/src/bithumb.d.ts +1 -1
- package/js/src/bitmex.d.ts +1 -1
- package/js/src/bitopro.d.ts +1 -1
- package/js/src/bitso.d.ts +1 -1
- package/js/src/bittrade.d.ts +1 -1
- package/js/src/blofin.d.ts +1 -1
- package/js/src/btcmarkets.d.ts +1 -1
- package/js/src/btcmarkets.js +4 -2
- package/js/src/bybit.d.ts +1 -1
- package/js/src/coinbase.d.ts +1 -1
- package/js/src/coinbase.js +1 -0
- package/js/src/coinex.d.ts +1 -1
- package/js/src/cryptocom.d.ts +1 -1
- package/js/src/deribit.js +21 -19
- package/js/src/digifinex.d.ts +1 -1
- package/js/src/hibachi.d.ts +1 -1
- package/js/src/htx.d.ts +1 -1
- package/js/src/hyperliquid.d.ts +1 -1
- package/js/src/kraken.d.ts +1 -1
- package/js/src/kraken.js +4 -0
- package/js/src/kucoin.js +1 -1
- package/js/src/kucoinfutures.d.ts +1 -1
- package/js/src/latoken.js +1 -0
- package/js/src/mexc.d.ts +1 -1
- package/js/src/mexc.js +1 -0
- package/js/src/oceanex.d.ts +1 -1
- package/js/src/okx.d.ts +1 -1
- package/js/src/onetrading.d.ts +1 -1
- package/js/src/onetrading.js +2 -1
- package/js/src/phemex.js +1 -0
- package/js/src/pro/bitget.d.ts +1 -0
- package/js/src/pro/bitget.js +1 -0
- package/js/src/pro/bitvavo.d.ts +2 -2
- package/js/src/pro/htx.js +22 -3
- package/js/src/pro/kraken.d.ts +7 -8
- package/js/src/pro/kraken.js +282 -458
- package/js/src/pro/mexc.js +15 -10
- package/js/src/probit.js +1 -1
- package/js/src/timex.d.ts +1 -1
- package/package.json +1 -1
- package/js/src/abstract/okcoin.d.ts +0 -77
- package/js/src/abstract/okcoin.js +0 -11
- package/js/src/okcoin.d.ts +0 -346
- package/js/src/okcoin.js +0 -3214
- package/js/src/pro/okcoin.d.ts +0 -91
- package/js/src/pro/okcoin.js +0 -763
|
@@ -590,55 +590,56 @@ class kraken extends kraken$1["default"] {
|
|
|
590
590
|
}
|
|
591
591
|
handleOHLCV(client, message, subscription) {
|
|
592
592
|
//
|
|
593
|
-
//
|
|
594
|
-
//
|
|
595
|
-
//
|
|
596
|
-
//
|
|
597
|
-
//
|
|
598
|
-
//
|
|
599
|
-
//
|
|
600
|
-
//
|
|
601
|
-
//
|
|
602
|
-
//
|
|
603
|
-
//
|
|
604
|
-
//
|
|
605
|
-
//
|
|
606
|
-
//
|
|
607
|
-
//
|
|
608
|
-
//
|
|
593
|
+
// {
|
|
594
|
+
// "channel": "ohlc",
|
|
595
|
+
// "type": "update",
|
|
596
|
+
// "timestamp": "2023-10-04T16:26:30.524394914Z",
|
|
597
|
+
// "data": [
|
|
598
|
+
// {
|
|
599
|
+
// "symbol": "MATIC/USD",
|
|
600
|
+
// "open": 0.5624,
|
|
601
|
+
// "high": 0.5628,
|
|
602
|
+
// "low": 0.5622,
|
|
603
|
+
// "close": 0.5627,
|
|
604
|
+
// "trades": 12,
|
|
605
|
+
// "volume": 30927.68066226,
|
|
606
|
+
// "vwap": 0.5626,
|
|
607
|
+
// "interval_begin": "2023-10-04T16:25:00.000000000Z",
|
|
608
|
+
// "interval": 5,
|
|
609
|
+
// "timestamp": "2023-10-04T16:30:00.000000Z"
|
|
610
|
+
// }
|
|
611
|
+
// ]
|
|
612
|
+
// }
|
|
609
613
|
//
|
|
610
|
-
const
|
|
611
|
-
const
|
|
612
|
-
const
|
|
613
|
-
const
|
|
614
|
-
const market = this.safeValue(this.options['marketsByWsName'], wsName);
|
|
615
|
-
const symbol = market['symbol'];
|
|
614
|
+
const data = this.safeList(message, 'data', []);
|
|
615
|
+
const first = data[0];
|
|
616
|
+
const symbol = this.safeString(first, 'symbol');
|
|
617
|
+
const interval = this.safeInteger(first, 'interval');
|
|
616
618
|
const timeframe = this.findTimeframe(interval);
|
|
617
|
-
const
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
619
|
+
const messageHash = this.getMessageHash('ohlcv', undefined, symbol);
|
|
620
|
+
let stored = this.safeValue(this.ohlcvs[symbol], timeframe);
|
|
621
|
+
this.ohlcvs[symbol] = this.safeValue(this.ohlcvs, symbol, {});
|
|
622
|
+
if (stored === undefined) {
|
|
623
|
+
const limit = this.safeInteger(this.options, 'OHLCVLimit', 1000);
|
|
624
|
+
stored = new Cache.ArrayCacheByTimestamp(limit);
|
|
625
|
+
this.ohlcvs[symbol][timeframe] = stored;
|
|
626
|
+
}
|
|
627
|
+
const ohlcvsLength = data.length;
|
|
628
|
+
for (let i = 0; i < ohlcvsLength; i++) {
|
|
629
|
+
const candle = data[ohlcvsLength - i - 1];
|
|
630
|
+
const datetime = this.safeString(candle, 'timestamp');
|
|
631
|
+
const timestamp = this.parse8601(datetime);
|
|
632
|
+
const parsed = [
|
|
633
|
+
timestamp,
|
|
634
|
+
this.safeString(candle, 'open'),
|
|
635
|
+
this.safeString(candle, 'high'),
|
|
636
|
+
this.safeString(candle, 'low'),
|
|
637
|
+
this.safeString(candle, 'close'),
|
|
638
|
+
this.safeString(candle, 'volume'),
|
|
631
639
|
];
|
|
632
|
-
|
|
633
|
-
let stored = this.safeValue(this.ohlcvs[symbol], timeframe);
|
|
634
|
-
if (stored === undefined) {
|
|
635
|
-
const limit = this.safeInteger(this.options, 'OHLCVLimit', 1000);
|
|
636
|
-
stored = new Cache.ArrayCacheByTimestamp(limit);
|
|
637
|
-
this.ohlcvs[symbol][timeframe] = stored;
|
|
638
|
-
}
|
|
639
|
-
stored.append(result);
|
|
640
|
-
client.resolve(stored, messageHash);
|
|
640
|
+
stored.append(parsed);
|
|
641
641
|
}
|
|
642
|
+
client.resolve(stored, messageHash);
|
|
642
643
|
}
|
|
643
644
|
requestId() {
|
|
644
645
|
// their support said that reqid must be an int32, not documented
|
|
@@ -646,26 +647,6 @@ class kraken extends kraken$1["default"] {
|
|
|
646
647
|
this.options['reqid'] = reqid;
|
|
647
648
|
return reqid;
|
|
648
649
|
}
|
|
649
|
-
async watchPublic(name, symbol, params = {}) {
|
|
650
|
-
await this.loadMarkets();
|
|
651
|
-
const market = this.market(symbol);
|
|
652
|
-
const wsName = this.safeValue(market['info'], 'wsname');
|
|
653
|
-
const messageHash = name + ':' + wsName;
|
|
654
|
-
const url = this.urls['api']['ws']['public'];
|
|
655
|
-
const requestId = this.requestId();
|
|
656
|
-
const subscribe = {
|
|
657
|
-
'event': 'subscribe',
|
|
658
|
-
'reqid': requestId,
|
|
659
|
-
'pair': [
|
|
660
|
-
wsName,
|
|
661
|
-
],
|
|
662
|
-
'subscription': {
|
|
663
|
-
'name': name,
|
|
664
|
-
},
|
|
665
|
-
};
|
|
666
|
-
const request = this.deepExtend(subscribe, params);
|
|
667
|
-
return await this.watch(url, messageHash, request, messageHash);
|
|
668
|
-
}
|
|
669
650
|
/**
|
|
670
651
|
* @method
|
|
671
652
|
* @name kraken#watchTicker
|
|
@@ -796,7 +777,7 @@ class kraken extends kraken$1["default"] {
|
|
|
796
777
|
* @method
|
|
797
778
|
* @name kraken#watchOHLCV
|
|
798
779
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
799
|
-
* @see https://docs.kraken.com/api/docs/websocket-
|
|
780
|
+
* @see https://docs.kraken.com/api/docs/websocket-v2/ohlc
|
|
800
781
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
801
782
|
* @param {string} timeframe the length of time each candle represents
|
|
802
783
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -809,27 +790,24 @@ class kraken extends kraken$1["default"] {
|
|
|
809
790
|
const name = 'ohlc';
|
|
810
791
|
const market = this.market(symbol);
|
|
811
792
|
symbol = market['symbol'];
|
|
812
|
-
const
|
|
813
|
-
const messageHash = name + ':' + timeframe + ':' + wsName;
|
|
814
|
-
const url = this.urls['api']['ws']['public'];
|
|
793
|
+
const url = this.urls['api']['ws']['publicV2'];
|
|
815
794
|
const requestId = this.requestId();
|
|
795
|
+
const messageHash = this.getMessageHash('ohlcv', undefined, symbol);
|
|
816
796
|
const subscribe = {
|
|
817
|
-
'
|
|
818
|
-
'
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
],
|
|
822
|
-
'subscription': {
|
|
823
|
-
'name': name,
|
|
797
|
+
'method': 'subscribe',
|
|
798
|
+
'params': {
|
|
799
|
+
'channel': name,
|
|
800
|
+
'symbol': [symbol],
|
|
824
801
|
'interval': this.safeValue(this.timeframes, timeframe, timeframe),
|
|
825
802
|
},
|
|
803
|
+
'req_id': requestId,
|
|
826
804
|
};
|
|
827
805
|
const request = this.deepExtend(subscribe, params);
|
|
828
806
|
const ohlcv = await this.watch(url, messageHash, request, messageHash);
|
|
829
807
|
if (this.newUpdates) {
|
|
830
808
|
limit = ohlcv.getLimit(symbol, limit);
|
|
831
809
|
}
|
|
832
|
-
return this.filterBySinceLimit(ohlcv, since, limit,
|
|
810
|
+
return this.filterBySinceLimit(ohlcv, since, limit, 'timestamp', true);
|
|
833
811
|
}
|
|
834
812
|
async loadMarkets(reload = false, params = {}) {
|
|
835
813
|
const markets = await super.loadMarkets(reload, params);
|
|
@@ -865,16 +843,16 @@ class kraken extends kraken$1["default"] {
|
|
|
865
843
|
async watchHeartbeat(params = {}) {
|
|
866
844
|
await this.loadMarkets();
|
|
867
845
|
const event = 'heartbeat';
|
|
868
|
-
const url = this.urls['api']['ws']['
|
|
846
|
+
const url = this.urls['api']['ws']['publicV2'];
|
|
869
847
|
return await this.watch(url, event);
|
|
870
848
|
}
|
|
871
849
|
handleHeartbeat(client, message) {
|
|
872
850
|
//
|
|
873
851
|
// every second (approx) if no other updates are sent
|
|
874
852
|
//
|
|
875
|
-
// { "
|
|
853
|
+
// { "channel": "heartbeat" }
|
|
876
854
|
//
|
|
877
|
-
const event = this.safeString(message, '
|
|
855
|
+
const event = this.safeString(message, 'channel');
|
|
878
856
|
client.resolve(message, event);
|
|
879
857
|
}
|
|
880
858
|
handleOrderBook(client, message) {
|
|
@@ -1095,24 +1073,26 @@ class kraken extends kraken$1["default"] {
|
|
|
1095
1073
|
async watchPrivate(name, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1096
1074
|
await this.loadMarkets();
|
|
1097
1075
|
const token = await this.authenticate();
|
|
1098
|
-
const subscriptionHash =
|
|
1076
|
+
const subscriptionHash = 'executions';
|
|
1099
1077
|
let messageHash = name;
|
|
1100
1078
|
if (symbol !== undefined) {
|
|
1101
1079
|
symbol = this.symbol(symbol);
|
|
1102
1080
|
messageHash += ':' + symbol;
|
|
1103
1081
|
}
|
|
1104
|
-
const url = this.urls['api']['ws']['
|
|
1082
|
+
const url = this.urls['api']['ws']['privateV2'];
|
|
1105
1083
|
const requestId = this.requestId();
|
|
1106
1084
|
const subscribe = {
|
|
1107
|
-
'
|
|
1108
|
-
'
|
|
1109
|
-
|
|
1110
|
-
'name': name,
|
|
1085
|
+
'method': 'subscribe',
|
|
1086
|
+
'params': {
|
|
1087
|
+
'channel': 'executions',
|
|
1111
1088
|
'token': token,
|
|
1112
1089
|
},
|
|
1090
|
+
'req_id': requestId,
|
|
1113
1091
|
};
|
|
1114
|
-
|
|
1115
|
-
|
|
1092
|
+
if (params !== undefined) {
|
|
1093
|
+
subscribe['params'] = this.deepExtend(subscribe['params'], params);
|
|
1094
|
+
}
|
|
1095
|
+
const result = await this.watch(url, messageHash, subscribe, subscriptionHash);
|
|
1116
1096
|
if (this.newUpdates) {
|
|
1117
1097
|
limit = result.getLimit(symbol, limit);
|
|
1118
1098
|
}
|
|
@@ -1122,7 +1102,7 @@ class kraken extends kraken$1["default"] {
|
|
|
1122
1102
|
* @method
|
|
1123
1103
|
* @name kraken#watchMyTrades
|
|
1124
1104
|
* @description watches information on multiple trades made by the user
|
|
1125
|
-
* @see https://docs.kraken.com/api/docs/websocket-
|
|
1105
|
+
* @see https://docs.kraken.com/api/docs/websocket-v2/executions
|
|
1126
1106
|
* @param {string} symbol unified market symbol of the market trades were made in
|
|
1127
1107
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
1128
1108
|
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
@@ -1130,48 +1110,42 @@ class kraken extends kraken$1["default"] {
|
|
|
1130
1110
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
1131
1111
|
*/
|
|
1132
1112
|
async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1133
|
-
|
|
1113
|
+
params['snap_trades'] = true;
|
|
1114
|
+
return await this.watchPrivate('myTrades', symbol, since, limit, params);
|
|
1134
1115
|
}
|
|
1135
1116
|
handleMyTrades(client, message, subscription = undefined) {
|
|
1136
1117
|
//
|
|
1137
|
-
//
|
|
1138
|
-
//
|
|
1139
|
-
//
|
|
1140
|
-
//
|
|
1141
|
-
// "cost": "1493.90107",
|
|
1142
|
-
// "fee": "3.88415",
|
|
1143
|
-
// "margin": "0.00000",
|
|
1144
|
-
// "ordertxid": "OTLAS3-RRHUF-NDWH5A",
|
|
1145
|
-
// "ordertype": "market",
|
|
1146
|
-
// "pair": "XBT/USDT",
|
|
1147
|
-
// "postxid": "TKH2SE-M7IF5-CFI7LT",
|
|
1148
|
-
// "price": "6851.50005",
|
|
1149
|
-
// "time": "1586822919.335498",
|
|
1150
|
-
// "type": "sell",
|
|
1151
|
-
// "vol": "0.21804000"
|
|
1152
|
-
// }
|
|
1153
|
-
// },
|
|
1118
|
+
// {
|
|
1119
|
+
// "channel": "executions",
|
|
1120
|
+
// "type": "update",
|
|
1121
|
+
// "data": [
|
|
1154
1122
|
// {
|
|
1155
|
-
// "
|
|
1156
|
-
//
|
|
1157
|
-
//
|
|
1158
|
-
//
|
|
1159
|
-
//
|
|
1160
|
-
//
|
|
1161
|
-
//
|
|
1162
|
-
//
|
|
1163
|
-
//
|
|
1164
|
-
//
|
|
1165
|
-
//
|
|
1166
|
-
//
|
|
1167
|
-
//
|
|
1168
|
-
//
|
|
1123
|
+
// "order_id": "O6NTZC-K6FRH-ATWBCK",
|
|
1124
|
+
// "exec_id": "T5DIUI-5N4KO-Z5BPXK",
|
|
1125
|
+
// "exec_type": "trade",
|
|
1126
|
+
// "trade_id": 8253473,
|
|
1127
|
+
// "symbol": "USDC/USD",
|
|
1128
|
+
// "side": "sell",
|
|
1129
|
+
// "last_qty": 15.44,
|
|
1130
|
+
// "last_price": 1.0002,
|
|
1131
|
+
// "liquidity_ind": "t",
|
|
1132
|
+
// "cost": 15.443088,
|
|
1133
|
+
// "order_userref": 0,
|
|
1134
|
+
// "order_status": "filled",
|
|
1135
|
+
// "order_type": "market",
|
|
1136
|
+
// "fee_usd_equiv": 0.03088618,
|
|
1137
|
+
// "fees": [
|
|
1138
|
+
// {
|
|
1139
|
+
// "asset": "USD",
|
|
1140
|
+
// "qty": 0.3458
|
|
1141
|
+
// }
|
|
1142
|
+
// ]
|
|
1143
|
+
// }
|
|
1169
1144
|
// ],
|
|
1170
|
-
// "
|
|
1171
|
-
//
|
|
1172
|
-
// ]
|
|
1145
|
+
// "sequence": 10
|
|
1146
|
+
// }
|
|
1173
1147
|
//
|
|
1174
|
-
const allTrades = this.
|
|
1148
|
+
const allTrades = this.safeList(message, 'data', []);
|
|
1175
1149
|
const allTradesLength = allTrades.length;
|
|
1176
1150
|
if (allTradesLength > 0) {
|
|
1177
1151
|
if (this.myTrades === undefined) {
|
|
@@ -1181,18 +1155,13 @@ class kraken extends kraken$1["default"] {
|
|
|
1181
1155
|
const stored = this.myTrades;
|
|
1182
1156
|
const symbols = {};
|
|
1183
1157
|
for (let i = 0; i < allTrades.length; i++) {
|
|
1184
|
-
const
|
|
1185
|
-
const
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
const parsed = this.parseWsTrade(this.extend({ 'id': id }, trade));
|
|
1190
|
-
stored.append(parsed);
|
|
1191
|
-
const symbol = parsed['symbol'];
|
|
1192
|
-
symbols[symbol] = true;
|
|
1193
|
-
}
|
|
1158
|
+
const trade = this.safeDict(allTrades, i, {});
|
|
1159
|
+
const parsed = this.parseWsTrade(trade);
|
|
1160
|
+
stored.append(parsed);
|
|
1161
|
+
const symbol = parsed['symbol'];
|
|
1162
|
+
symbols[symbol] = true;
|
|
1194
1163
|
}
|
|
1195
|
-
const name = '
|
|
1164
|
+
const name = 'myTrades';
|
|
1196
1165
|
client.resolve(this.myTrades, name);
|
|
1197
1166
|
const keys = Object.keys(symbols);
|
|
1198
1167
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -1204,87 +1173,65 @@ class kraken extends kraken$1["default"] {
|
|
|
1204
1173
|
parseWsTrade(trade, market = undefined) {
|
|
1205
1174
|
//
|
|
1206
1175
|
// {
|
|
1207
|
-
// "
|
|
1208
|
-
// "
|
|
1209
|
-
// "
|
|
1210
|
-
// "
|
|
1211
|
-
// "
|
|
1212
|
-
// "
|
|
1213
|
-
// "
|
|
1214
|
-
// "
|
|
1215
|
-
// "
|
|
1216
|
-
// "
|
|
1217
|
-
// "
|
|
1218
|
-
// "
|
|
1219
|
-
// "
|
|
1220
|
-
//
|
|
1221
|
-
//
|
|
1222
|
-
//
|
|
1223
|
-
//
|
|
1224
|
-
//
|
|
1225
|
-
//
|
|
1226
|
-
//
|
|
1227
|
-
// "ordertxid": "ODQXS7-MOLK6-ICXKAA",
|
|
1228
|
-
// "ordertype": "market",
|
|
1229
|
-
// "pair": "ETH/USD",
|
|
1230
|
-
// "postxid": "TKH2SE-M7IF5-CFI7LT",
|
|
1231
|
-
// "price": "169.97999",
|
|
1232
|
-
// "time": "1586340530.895739",
|
|
1233
|
-
// "type": "buy",
|
|
1234
|
-
// "vol": "0.13043500"
|
|
1176
|
+
// "order_id": "O6NTZC-K6FRH-ATWBCK",
|
|
1177
|
+
// "exec_id": "T5DIUI-5N4KO-Z5BPXK",
|
|
1178
|
+
// "exec_type": "trade",
|
|
1179
|
+
// "trade_id": 8253473,
|
|
1180
|
+
// "symbol": "USDC/USD",
|
|
1181
|
+
// "side": "sell",
|
|
1182
|
+
// "last_qty": 15.44,
|
|
1183
|
+
// "last_price": 1.0002,
|
|
1184
|
+
// "liquidity_ind": "t",
|
|
1185
|
+
// "cost": 15.443088,
|
|
1186
|
+
// "order_userref": 0,
|
|
1187
|
+
// "order_status": "filled",
|
|
1188
|
+
// "order_type": "market",
|
|
1189
|
+
// "fee_usd_equiv": 0.03088618,
|
|
1190
|
+
// "fees": [
|
|
1191
|
+
// {
|
|
1192
|
+
// "asset": "USD",
|
|
1193
|
+
// "qty": 0.3458
|
|
1194
|
+
// }
|
|
1195
|
+
// ]
|
|
1235
1196
|
// }
|
|
1236
1197
|
//
|
|
1237
|
-
|
|
1238
|
-
market = this.safeValue(this.options['marketsByWsName'], wsName, market);
|
|
1239
|
-
let symbol = undefined;
|
|
1240
|
-
const orderId = this.safeString(trade, 'ordertxid');
|
|
1241
|
-
const id = this.safeString2(trade, 'id', 'postxid');
|
|
1242
|
-
const timestamp = this.safeTimestamp(trade, 'time');
|
|
1243
|
-
const side = this.safeString(trade, 'type');
|
|
1244
|
-
const type = this.safeString(trade, 'ordertype');
|
|
1245
|
-
const price = this.safeFloat(trade, 'price');
|
|
1246
|
-
const amount = this.safeFloat(trade, 'vol');
|
|
1247
|
-
let cost = undefined;
|
|
1248
|
-
let fee = undefined;
|
|
1249
|
-
if ('fee' in trade) {
|
|
1250
|
-
let currency = undefined;
|
|
1251
|
-
if (market !== undefined) {
|
|
1252
|
-
currency = market['quote'];
|
|
1253
|
-
}
|
|
1254
|
-
fee = {
|
|
1255
|
-
'cost': this.safeFloat(trade, 'fee'),
|
|
1256
|
-
'currency': currency,
|
|
1257
|
-
};
|
|
1258
|
-
}
|
|
1198
|
+
let symbol = this.safeString(trade, 'symbol');
|
|
1259
1199
|
if (market !== undefined) {
|
|
1260
1200
|
symbol = market['symbol'];
|
|
1261
1201
|
}
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
}
|
|
1202
|
+
let fee = undefined;
|
|
1203
|
+
if ('fees' in trade) {
|
|
1204
|
+
const fees = this.safeList(trade, 'fees', []);
|
|
1205
|
+
const firstFee = this.safeDict(fees, 0, {});
|
|
1206
|
+
fee = {
|
|
1207
|
+
'cost': this.safeNumber(firstFee, 'qty'),
|
|
1208
|
+
'currency': this.safeString(firstFee, 'asset'),
|
|
1209
|
+
};
|
|
1266
1210
|
}
|
|
1211
|
+
const datetime = this.safeString(trade, 'timestamp');
|
|
1212
|
+
const liquidityIndicator = this.safeString(trade, 'liquidity_ind');
|
|
1213
|
+
const takerOrMaker = (liquidityIndicator === 't') ? 'taker' : 'maker';
|
|
1267
1214
|
return {
|
|
1268
|
-
'id': id,
|
|
1269
|
-
'order': orderId,
|
|
1270
1215
|
'info': trade,
|
|
1271
|
-
'
|
|
1272
|
-
'
|
|
1216
|
+
'id': this.safeString(trade, 'exec_id'),
|
|
1217
|
+
'order': this.safeString(trade, 'order_id'),
|
|
1218
|
+
'timestamp': this.parse8601(datetime),
|
|
1219
|
+
'datetime': datetime,
|
|
1273
1220
|
'symbol': symbol,
|
|
1274
|
-
'type':
|
|
1275
|
-
'side': side,
|
|
1276
|
-
'takerOrMaker':
|
|
1277
|
-
'price':
|
|
1278
|
-
'amount':
|
|
1279
|
-
'cost': cost,
|
|
1221
|
+
'type': this.safeString(trade, 'order_type'),
|
|
1222
|
+
'side': this.safeString(trade, 'side'),
|
|
1223
|
+
'takerOrMaker': takerOrMaker,
|
|
1224
|
+
'price': this.safeNumber(trade, 'last_price'),
|
|
1225
|
+
'amount': this.safeNumber(trade, 'last_qty'),
|
|
1226
|
+
'cost': this.safeNumber(trade, 'cost'),
|
|
1280
1227
|
'fee': fee,
|
|
1281
1228
|
};
|
|
1282
1229
|
}
|
|
1283
1230
|
/**
|
|
1284
1231
|
* @method
|
|
1285
1232
|
* @name kraken#watchOrders
|
|
1286
|
-
* @see https://docs.kraken.com/api/docs/websocket-v1/openorders
|
|
1287
1233
|
* @description watches information on multiple orders made by the user
|
|
1234
|
+
* @see https://docs.kraken.com/api/docs/websocket-v2/executions
|
|
1288
1235
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1289
1236
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
1290
1237
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
@@ -1292,87 +1239,38 @@ class kraken extends kraken$1["default"] {
|
|
|
1292
1239
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1293
1240
|
*/
|
|
1294
1241
|
async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1295
|
-
|
|
1242
|
+
params['snap_orders'] = true;
|
|
1243
|
+
return await this.watchPrivate('orders', symbol, since, limit, params);
|
|
1296
1244
|
}
|
|
1297
1245
|
handleOrders(client, message, subscription = undefined) {
|
|
1298
1246
|
//
|
|
1299
|
-
//
|
|
1300
|
-
//
|
|
1301
|
-
//
|
|
1302
|
-
//
|
|
1303
|
-
// "cost": "0.00000",
|
|
1304
|
-
// "descr": {
|
|
1305
|
-
// "close": "",
|
|
1306
|
-
// "leverage": "0:1",
|
|
1307
|
-
// "order": "sell 10.00345345 XBT/EUR @ limit 34.50000 with 0:1 leverage",
|
|
1308
|
-
// "ordertype": "limit",
|
|
1309
|
-
// "pair": "XBT/EUR",
|
|
1310
|
-
// "price": "34.50000",
|
|
1311
|
-
// "price2": "0.00000",
|
|
1312
|
-
// "type": "sell"
|
|
1313
|
-
// },
|
|
1314
|
-
// "expiretm": "0.000000",
|
|
1315
|
-
// "fee": "0.00000",
|
|
1316
|
-
// "limitprice": "34.50000",
|
|
1317
|
-
// "misc": "",
|
|
1318
|
-
// "oflags": "fcib",
|
|
1319
|
-
// "opentm": "0.000000",
|
|
1320
|
-
// "price": "34.50000",
|
|
1321
|
-
// "refid": "OKIVMP-5GVZN-Z2D2UA",
|
|
1322
|
-
// "starttm": "0.000000",
|
|
1323
|
-
// "status": "open",
|
|
1324
|
-
// "stopprice": "0.000000",
|
|
1325
|
-
// "userref": 0,
|
|
1326
|
-
// "vol": "10.00345345",
|
|
1327
|
-
// "vol_exec": "0.00000000"
|
|
1328
|
-
// }
|
|
1329
|
-
// },
|
|
1247
|
+
// {
|
|
1248
|
+
// "channel": "executions",
|
|
1249
|
+
// "type": "update",
|
|
1250
|
+
// "data": [
|
|
1330
1251
|
// {
|
|
1331
|
-
// "
|
|
1332
|
-
//
|
|
1333
|
-
//
|
|
1334
|
-
//
|
|
1335
|
-
//
|
|
1336
|
-
//
|
|
1337
|
-
//
|
|
1338
|
-
//
|
|
1339
|
-
//
|
|
1340
|
-
//
|
|
1341
|
-
//
|
|
1342
|
-
//
|
|
1343
|
-
//
|
|
1344
|
-
//
|
|
1345
|
-
//
|
|
1346
|
-
//
|
|
1347
|
-
//
|
|
1348
|
-
// "opentm": "0.000000",
|
|
1349
|
-
// "price": "5334.60000",
|
|
1350
|
-
// "refid": "OKIVMP-5GVZN-Z2D2UA",
|
|
1351
|
-
// "starttm": "0.000000",
|
|
1352
|
-
// "status": "open",
|
|
1353
|
-
// "stopprice": "0.000000",
|
|
1354
|
-
// "userref": 0,
|
|
1355
|
-
// "vol": "0.00000010",
|
|
1356
|
-
// "vol_exec": "0.00000000"
|
|
1357
|
-
// }
|
|
1358
|
-
// },
|
|
1359
|
-
// ],
|
|
1360
|
-
// "openOrders",
|
|
1361
|
-
// { "sequence": 234 }
|
|
1362
|
-
// ]
|
|
1363
|
-
//
|
|
1364
|
-
// status-change
|
|
1365
|
-
//
|
|
1366
|
-
// [
|
|
1367
|
-
// [
|
|
1368
|
-
// { "OGTT3Y-C6I3P-XRI6HX": { "status": "closed" }},
|
|
1369
|
-
// { "OGTT3Y-C6I3P-XRI6HX": { "status": "closed" }},
|
|
1252
|
+
// "order_id": "OK4GJX-KSTLS-7DZZO5",
|
|
1253
|
+
// "order_userref": 3,
|
|
1254
|
+
// "symbol": "BTC/USD",
|
|
1255
|
+
// "order_qty": 0.005,
|
|
1256
|
+
// "cum_cost": 0.0,
|
|
1257
|
+
// "time_in_force": "GTC",
|
|
1258
|
+
// "exec_type": "pending_new",
|
|
1259
|
+
// "side": "sell",
|
|
1260
|
+
// "order_type": "limit",
|
|
1261
|
+
// "limit_price_type": "static",
|
|
1262
|
+
// "limit_price": 26500.0,
|
|
1263
|
+
// "stop_price": 0.0,
|
|
1264
|
+
// "order_status": "pending_new",
|
|
1265
|
+
// "fee_usd_equiv": 0.0,
|
|
1266
|
+
// "fee_ccy_pref": "fciq",
|
|
1267
|
+
// "timestamp": "2023-09-22T10:33:05.709950Z"
|
|
1268
|
+
// }
|
|
1370
1269
|
// ],
|
|
1371
|
-
// "
|
|
1372
|
-
//
|
|
1373
|
-
// ]
|
|
1270
|
+
// "sequence": 8
|
|
1271
|
+
// }
|
|
1374
1272
|
//
|
|
1375
|
-
const allOrders = this.
|
|
1273
|
+
const allOrders = this.safeList(message, 'data', []);
|
|
1376
1274
|
const allOrdersLength = allOrders.length;
|
|
1377
1275
|
if (allOrdersLength > 0) {
|
|
1378
1276
|
const limit = this.safeInteger(this.options, 'ordersLimit', 1000);
|
|
@@ -1382,43 +1280,29 @@ class kraken extends kraken$1["default"] {
|
|
|
1382
1280
|
const stored = this.orders;
|
|
1383
1281
|
const symbols = {};
|
|
1384
1282
|
for (let i = 0; i < allOrders.length; i++) {
|
|
1385
|
-
const
|
|
1386
|
-
const
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1283
|
+
const order = this.safeDict(allOrders, i, {});
|
|
1284
|
+
const id = this.safeString(order, 'order_id');
|
|
1285
|
+
const parsed = this.parseWsOrder(order);
|
|
1286
|
+
const symbol = this.safeString(order, 'symbol');
|
|
1287
|
+
const previousOrders = this.safeValue(stored.hashmap, symbol);
|
|
1288
|
+
const previousOrder = this.safeValue(previousOrders, id);
|
|
1289
|
+
let newOrder = parsed;
|
|
1290
|
+
if (previousOrder !== undefined) {
|
|
1291
|
+
const newRawOrder = this.extend(previousOrder['info'], newOrder['info']);
|
|
1292
|
+
newOrder = this.parseWsOrder(newRawOrder);
|
|
1293
|
+
}
|
|
1294
|
+
const length = stored.length;
|
|
1295
|
+
if (length === limit && (previousOrder === undefined)) {
|
|
1296
|
+
const first = stored[0];
|
|
1393
1297
|
const symbolsByOrderId = this.safeValue(this.options, 'symbolsByOrderId', {});
|
|
1394
|
-
if (
|
|
1395
|
-
|
|
1396
|
-
symbolsByOrderId[id] = symbol;
|
|
1397
|
-
this.options['symbolsByOrderId'] = symbolsByOrderId;
|
|
1298
|
+
if (first['id'] in symbolsByOrderId) {
|
|
1299
|
+
delete symbolsByOrderId[first['id']];
|
|
1398
1300
|
}
|
|
1399
|
-
else {
|
|
1400
|
-
symbol = this.safeString(symbolsByOrderId, id);
|
|
1401
|
-
}
|
|
1402
|
-
const previousOrders = this.safeValue(stored.hashmap, symbol);
|
|
1403
|
-
const previousOrder = this.safeValue(previousOrders, id);
|
|
1404
|
-
let newOrder = parsed;
|
|
1405
|
-
if (previousOrder !== undefined) {
|
|
1406
|
-
const newRawOrder = this.extend(previousOrder['info'], newOrder['info']);
|
|
1407
|
-
newOrder = this.parseWsOrder(newRawOrder);
|
|
1408
|
-
newOrder['id'] = id;
|
|
1409
|
-
}
|
|
1410
|
-
const length = stored.length;
|
|
1411
|
-
if (length === limit && (previousOrder === undefined)) {
|
|
1412
|
-
const first = stored[0];
|
|
1413
|
-
if (first['id'] in symbolsByOrderId) {
|
|
1414
|
-
delete symbolsByOrderId[first['id']];
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
stored.append(newOrder);
|
|
1418
|
-
symbols[symbol] = true;
|
|
1419
1301
|
}
|
|
1302
|
+
stored.append(newOrder);
|
|
1303
|
+
symbols[symbol] = true;
|
|
1420
1304
|
}
|
|
1421
|
-
const name = '
|
|
1305
|
+
const name = 'orders';
|
|
1422
1306
|
client.resolve(this.orders, name);
|
|
1423
1307
|
const keys = Object.keys(symbols);
|
|
1424
1308
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -1429,122 +1313,73 @@ class kraken extends kraken$1["default"] {
|
|
|
1429
1313
|
}
|
|
1430
1314
|
parseWsOrder(order, market = undefined) {
|
|
1431
1315
|
//
|
|
1432
|
-
//
|
|
1433
|
-
// {
|
|
1434
|
-
// "avg_price": "0.00000",
|
|
1435
|
-
// "cost": "0.00000",
|
|
1436
|
-
// "descr": {
|
|
1437
|
-
// "close": null,
|
|
1438
|
-
// "leverage": null,
|
|
1439
|
-
// "order": "sell 0.01000000 ETH/USDT @ limit 1900.00000",
|
|
1440
|
-
// "ordertype": "limit",
|
|
1441
|
-
// "pair": "ETH/USDT",
|
|
1442
|
-
// "price": "1900.00000",
|
|
1443
|
-
// "price2": "0.00000",
|
|
1444
|
-
// "type": "sell"
|
|
1445
|
-
// },
|
|
1446
|
-
// "expiretm": null,
|
|
1447
|
-
// "fee": "0.00000",
|
|
1448
|
-
// "limitprice": "0.00000",
|
|
1449
|
-
// "misc": '',
|
|
1450
|
-
// "oflags": "fciq",
|
|
1451
|
-
// "opentm": "1667522705.757622",
|
|
1452
|
-
// "refid": null,
|
|
1453
|
-
// "starttm": null,
|
|
1454
|
-
// "status": "open",
|
|
1455
|
-
// "stopprice": "0.00000",
|
|
1456
|
-
// "timeinforce": "GTC",
|
|
1457
|
-
// "userref": 0,
|
|
1458
|
-
// "vol": "0.01000000",
|
|
1459
|
-
// "vol_exec": "0.00000000"
|
|
1460
|
-
// }
|
|
1316
|
+
// watchOrders
|
|
1461
1317
|
//
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
if (flags.indexOf('fciq') >= 0) {
|
|
1505
|
-
fee['currency'] = market['quote'];
|
|
1506
|
-
}
|
|
1507
|
-
else if (flags.indexOf('fcib') >= 0) {
|
|
1508
|
-
fee['currency'] = market['base'];
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
const status = this.parseOrderStatus(this.safeString(order, 'status'));
|
|
1513
|
-
let id = this.safeString(order, 'id');
|
|
1514
|
-
if (id === undefined) {
|
|
1515
|
-
const txid = this.safeValue(order, 'txid');
|
|
1516
|
-
id = this.safeString(txid, 0);
|
|
1517
|
-
}
|
|
1518
|
-
const clientOrderId = this.safeString(order, 'userref');
|
|
1519
|
-
const rawTrades = this.safeValue(order, 'trades');
|
|
1520
|
-
let trades = undefined;
|
|
1521
|
-
if (rawTrades !== undefined) {
|
|
1522
|
-
trades = this.parseTrades(rawTrades, market, undefined, undefined, { 'order': id });
|
|
1523
|
-
}
|
|
1524
|
-
const stopPrice = this.safeNumber(order, 'stopprice');
|
|
1318
|
+
// open order
|
|
1319
|
+
// {
|
|
1320
|
+
// "order_id": "OK4GJX-KSTLS-7DZZO5",
|
|
1321
|
+
// "order_userref": 3,
|
|
1322
|
+
// "symbol": "BTC/USD",
|
|
1323
|
+
// "order_qty": 0.005,
|
|
1324
|
+
// "cum_cost": 0.0,
|
|
1325
|
+
// "time_in_force": "GTC",
|
|
1326
|
+
// "exec_type": "pending_new",
|
|
1327
|
+
// "side": "sell",
|
|
1328
|
+
// "order_type": "limit",
|
|
1329
|
+
// "limit_price_type": "static",
|
|
1330
|
+
// "limit_price": 26500.0,
|
|
1331
|
+
// "stop_price": 0.0,
|
|
1332
|
+
// "order_status": "pending_new",
|
|
1333
|
+
// "fee_usd_equiv": 0.0,
|
|
1334
|
+
// "fee_ccy_pref": "fciq",
|
|
1335
|
+
// "timestamp": "2023-09-22T10:33:05.709950Z"
|
|
1336
|
+
// }
|
|
1337
|
+
//
|
|
1338
|
+
// canceled order
|
|
1339
|
+
//
|
|
1340
|
+
// {
|
|
1341
|
+
// "timestamp": "2025-10-11T15:11:47.695226Z",
|
|
1342
|
+
// "order_status": "canceled",
|
|
1343
|
+
// "exec_type": "canceled",
|
|
1344
|
+
// "order_userref": 0,
|
|
1345
|
+
// "order_id": "OGAB7Y-BKX5F-PTK5RW",
|
|
1346
|
+
// "cum_qty": 0,
|
|
1347
|
+
// "cum_cost": 0,
|
|
1348
|
+
// "fee_usd_equiv": 0,
|
|
1349
|
+
// "avg_price": 0,
|
|
1350
|
+
// "cancel_reason": "User requested",
|
|
1351
|
+
// "reason": "User requested"
|
|
1352
|
+
// }
|
|
1353
|
+
//
|
|
1354
|
+
const fee = {
|
|
1355
|
+
'cost': this.safeString(order, 'fee_usd_equiv'),
|
|
1356
|
+
'currency': 'USD',
|
|
1357
|
+
};
|
|
1358
|
+
const stopPrice = this.safeString(order, 'stop_price');
|
|
1359
|
+
const datetime = this.safeString(order, 'timestamp');
|
|
1525
1360
|
return this.safeOrder({
|
|
1526
|
-
'id':
|
|
1527
|
-
'clientOrderId':
|
|
1361
|
+
'id': this.safeString(order, 'order_id'),
|
|
1362
|
+
'clientOrderId': this.safeString(order, 'order_userref'),
|
|
1528
1363
|
'info': order,
|
|
1529
|
-
'timestamp':
|
|
1530
|
-
'datetime':
|
|
1364
|
+
'timestamp': this.parse8601(datetime),
|
|
1365
|
+
'datetime': datetime,
|
|
1531
1366
|
'lastTradeTimestamp': undefined,
|
|
1532
|
-
'status':
|
|
1533
|
-
'symbol': symbol,
|
|
1534
|
-
'type':
|
|
1535
|
-
'timeInForce':
|
|
1367
|
+
'status': this.parseOrderStatus(this.safeString(order, 'order_status')),
|
|
1368
|
+
'symbol': this.safeString(order, 'symbol'),
|
|
1369
|
+
'type': this.safeString(order, 'order_type'),
|
|
1370
|
+
'timeInForce': this.safeString(order, 'time_in_force'),
|
|
1536
1371
|
'postOnly': undefined,
|
|
1537
|
-
'side': side,
|
|
1538
|
-
'price':
|
|
1372
|
+
'side': this.safeString(order, 'side'),
|
|
1373
|
+
'price': this.safeString(order, 'limit_price'),
|
|
1539
1374
|
'stopPrice': stopPrice,
|
|
1540
1375
|
'triggerPrice': stopPrice,
|
|
1541
|
-
'cost':
|
|
1542
|
-
'amount':
|
|
1543
|
-
'filled':
|
|
1544
|
-
'average':
|
|
1376
|
+
'cost': this.safeString(order, 'cum_cost'),
|
|
1377
|
+
'amount': this.safeString2(order, 'order_qty', 'cum_qty'),
|
|
1378
|
+
'filled': undefined,
|
|
1379
|
+
'average': this.safeString(order, 'avg_price'),
|
|
1545
1380
|
'remaining': undefined,
|
|
1546
1381
|
'fee': fee,
|
|
1547
|
-
'trades':
|
|
1382
|
+
'trades': undefined,
|
|
1548
1383
|
});
|
|
1549
1384
|
}
|
|
1550
1385
|
async watchMultiHelper(unifiedName, channelName, symbols = undefined, subscriptionArgs = undefined, params = {}) {
|
|
@@ -1727,55 +1562,44 @@ class kraken extends kraken$1["default"] {
|
|
|
1727
1562
|
return true;
|
|
1728
1563
|
}
|
|
1729
1564
|
handleMessage(client, message) {
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1565
|
+
let channel = this.safeString(message, 'channel');
|
|
1566
|
+
if (channel !== undefined) {
|
|
1567
|
+
if (channel === 'executions') {
|
|
1568
|
+
const data = this.safeList(message, 'data', []);
|
|
1569
|
+
const first = this.safeDict(data, 0, {});
|
|
1570
|
+
const execType = this.safeString(first, 'exec_type');
|
|
1571
|
+
channel = (execType === 'trade') ? 'myTrades' : 'orders';
|
|
1572
|
+
}
|
|
1737
1573
|
const methods = {
|
|
1738
|
-
|
|
1574
|
+
'balances': this.handleBalance,
|
|
1575
|
+
'book': this.handleOrderBook,
|
|
1739
1576
|
'ohlc': this.handleOHLCV,
|
|
1577
|
+
'ticker': this.handleTicker,
|
|
1578
|
+
'trade': this.handleTrades,
|
|
1740
1579
|
// private
|
|
1741
|
-
'
|
|
1742
|
-
'
|
|
1580
|
+
'myTrades': this.handleMyTrades,
|
|
1581
|
+
'orders': this.handleOrders,
|
|
1743
1582
|
};
|
|
1744
|
-
const method = this.
|
|
1583
|
+
const method = this.safeValue(methods, channel);
|
|
1745
1584
|
if (method !== undefined) {
|
|
1746
|
-
method.call(this, client, message
|
|
1585
|
+
method.call(this, client, message);
|
|
1747
1586
|
}
|
|
1748
1587
|
}
|
|
1749
|
-
|
|
1750
|
-
const
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
const event = this.safeString2(message, 'event', 'method');
|
|
1765
|
-
const methods = {
|
|
1766
|
-
'heartbeat': this.handleHeartbeat,
|
|
1767
|
-
'systemStatus': this.handleSystemStatus,
|
|
1768
|
-
'subscriptionStatus': this.handleSubscriptionStatus,
|
|
1769
|
-
'add_order': this.handleCreateEditOrder,
|
|
1770
|
-
'amend_order': this.handleCreateEditOrder,
|
|
1771
|
-
'cancel_order': this.handleCancelOrder,
|
|
1772
|
-
'cancel_all': this.handleCancelAllOrders,
|
|
1773
|
-
'pong': this.handlePong,
|
|
1774
|
-
};
|
|
1775
|
-
const method = this.safeValue(methods, event);
|
|
1776
|
-
if (method !== undefined) {
|
|
1777
|
-
method.call(this, client, message);
|
|
1778
|
-
}
|
|
1588
|
+
if (this.handleErrorMessage(client, message)) {
|
|
1589
|
+
const event = this.safeString2(message, 'event', 'method');
|
|
1590
|
+
const methods = {
|
|
1591
|
+
'heartbeat': this.handleHeartbeat,
|
|
1592
|
+
'systemStatus': this.handleSystemStatus,
|
|
1593
|
+
'subscriptionStatus': this.handleSubscriptionStatus,
|
|
1594
|
+
'add_order': this.handleCreateEditOrder,
|
|
1595
|
+
'amend_order': this.handleCreateEditOrder,
|
|
1596
|
+
'cancel_order': this.handleCancelOrder,
|
|
1597
|
+
'cancel_all': this.handleCancelAllOrders,
|
|
1598
|
+
'pong': this.handlePong,
|
|
1599
|
+
};
|
|
1600
|
+
const method = this.safeValue(methods, event);
|
|
1601
|
+
if (method !== undefined) {
|
|
1602
|
+
method.call(this, client, message);
|
|
1779
1603
|
}
|
|
1780
1604
|
}
|
|
1781
1605
|
}
|