ccxt 4.3.72 → 4.3.74
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 -5
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +1 -1
- package/dist/cjs/src/base/ws/Client.js +2 -2
- package/dist/cjs/src/binance.js +236 -87
- package/dist/cjs/src/bybit.js +2 -2
- package/dist/cjs/src/pro/alpaca.js +5 -0
- package/dist/cjs/src/pro/binance.js +31 -3
- package/dist/cjs/src/pro/bitfinex.js +5 -0
- package/dist/cjs/src/pro/kucoin.js +7 -2
- package/dist/cjs/src/pro/woo.js +129 -12
- package/dist/cjs/src/woo.js +1 -1
- package/dist/cjs/src/yobit.js +55 -29
- package/examples/js/cli.js +13 -10
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +5 -0
- package/js/src/abstract/binancecoinm.d.ts +5 -0
- package/js/src/abstract/binanceus.d.ts +5 -0
- package/js/src/abstract/binanceusdm.d.ts +5 -0
- package/js/src/ace.js +1 -1
- package/js/src/base/ws/Client.js +2 -2
- package/js/src/binance.js +236 -87
- package/js/src/bybit.js +2 -2
- package/js/src/pro/alpaca.js +5 -0
- package/js/src/pro/binance.js +31 -3
- package/js/src/pro/bitfinex.js +5 -0
- package/js/src/pro/kucoin.js +7 -2
- package/js/src/pro/woo.d.ts +5 -0
- package/js/src/pro/woo.js +129 -12
- package/js/src/woo.js +1 -1
- package/js/src/yobit.d.ts +1 -0
- package/js/src/yobit.js +55 -29
- package/package.json +1 -1
|
@@ -931,10 +931,15 @@ class binance extends binance$1 {
|
|
|
931
931
|
* @method
|
|
932
932
|
* @name binance#watchTradesForSymbols
|
|
933
933
|
* @description get the list of most recent trades for a list of symbols
|
|
934
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#aggregate-trade-streams
|
|
935
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#trade-streams
|
|
936
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#aggregate-trade-streams
|
|
937
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#aggregate-trade-streams
|
|
934
938
|
* @param {string[]} symbols unified symbol of the market to fetch trades for
|
|
935
939
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
936
940
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
937
941
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
942
|
+
* @param {string} [params.name] the name of the method to call, 'trade' or 'aggTrade', default is 'trade'
|
|
938
943
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
939
944
|
*/
|
|
940
945
|
await this.loadMarkets();
|
|
@@ -947,8 +952,9 @@ class binance extends binance$1 {
|
|
|
947
952
|
}
|
|
948
953
|
streamHash += '::' + symbols.join(',');
|
|
949
954
|
}
|
|
950
|
-
|
|
951
|
-
|
|
955
|
+
let name = undefined;
|
|
956
|
+
[name, params] = this.handleOptionAndParams(params, 'watchTradesForSymbols', 'name', 'trade');
|
|
957
|
+
params = this.omit(params, 'callerMethodName');
|
|
952
958
|
const firstMarket = this.market(symbols[0]);
|
|
953
959
|
let type = firstMarket['type'];
|
|
954
960
|
if (firstMarket['contract']) {
|
|
@@ -988,12 +994,18 @@ class binance extends binance$1 {
|
|
|
988
994
|
* @method
|
|
989
995
|
* @name binance#watchTrades
|
|
990
996
|
* @description get the list of most recent trades for a particular symbol
|
|
997
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#aggregate-trade-streams
|
|
998
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#trade-streams
|
|
999
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#aggregate-trade-streams
|
|
1000
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#aggregate-trade-streams
|
|
991
1001
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
992
1002
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
993
1003
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
994
1004
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1005
|
+
* @param {string} [params.name] the name of the method to call, 'trade' or 'aggTrade', default is 'trade'
|
|
995
1006
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
996
1007
|
*/
|
|
1008
|
+
params['callerMethodName'] = 'watchTrades';
|
|
997
1009
|
return await this.watchTradesForSymbols([symbol], since, limit, params);
|
|
998
1010
|
}
|
|
999
1011
|
parseWsTrade(trade, market = undefined) {
|
|
@@ -1182,11 +1194,15 @@ class binance extends binance$1 {
|
|
|
1182
1194
|
* @method
|
|
1183
1195
|
* @name binance#watchOHLCV
|
|
1184
1196
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1197
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-data
|
|
1198
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#kline-candlestick-data
|
|
1199
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#kline-candlestick-data
|
|
1185
1200
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
1186
1201
|
* @param {string} timeframe the length of time each candle represents
|
|
1187
1202
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
1188
1203
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
1189
1204
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1205
|
+
* @param {object} [params.timezone] if provided, kline intervals are interpreted in that timezone instead of UTC, example '+08:00'
|
|
1190
1206
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
1191
1207
|
*/
|
|
1192
1208
|
params['callerMethodName'] = 'watchOHLCV';
|
|
@@ -1198,10 +1214,14 @@ class binance extends binance$1 {
|
|
|
1198
1214
|
* @method
|
|
1199
1215
|
* @name binance#watchOHLCVForSymbols
|
|
1200
1216
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1217
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-data
|
|
1218
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#kline-candlestick-data
|
|
1219
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#kline-candlestick-data
|
|
1201
1220
|
* @param {string[][]} symbolsAndTimeframes array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
|
|
1202
1221
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
1203
1222
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
1204
1223
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1224
|
+
* @param {object} [params.timezone] if provided, kline intervals are interpreted in that timezone instead of UTC, example '+08:00'
|
|
1205
1225
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
1206
1226
|
*/
|
|
1207
1227
|
await this.loadMarkets();
|
|
@@ -1214,6 +1234,10 @@ class binance extends binance$1 {
|
|
|
1214
1234
|
if (firstMarket['contract']) {
|
|
1215
1235
|
type = firstMarket['linear'] ? 'future' : 'delivery';
|
|
1216
1236
|
}
|
|
1237
|
+
const isSpot = (type === 'spot');
|
|
1238
|
+
let timezone = undefined;
|
|
1239
|
+
[timezone, params] = this.handleParamString(params, 'timezone', undefined);
|
|
1240
|
+
const isUtc8 = (timezone !== undefined) && ((timezone === '+08:00') || Precise["default"].stringEq(timezone, '8'));
|
|
1217
1241
|
const rawHashes = [];
|
|
1218
1242
|
const messageHashes = [];
|
|
1219
1243
|
for (let i = 0; i < symbolsAndTimeframes.length; i++) {
|
|
@@ -1227,7 +1251,10 @@ class binance extends binance$1 {
|
|
|
1227
1251
|
// weird behavior for index price kline we can't use the perp suffix
|
|
1228
1252
|
marketId = marketId.replace('_perp', '');
|
|
1229
1253
|
}
|
|
1230
|
-
|
|
1254
|
+
const shouldUseUTC8 = (isUtc8 && isSpot);
|
|
1255
|
+
const suffix = '@+08:00';
|
|
1256
|
+
const utcSuffix = shouldUseUTC8 ? suffix : '';
|
|
1257
|
+
rawHashes.push(marketId + '@' + klineType + '_' + interval + utcSuffix);
|
|
1231
1258
|
messageHashes.push('ohlcv::' + symbolString + '::' + timeframeString);
|
|
1232
1259
|
}
|
|
1233
1260
|
const url = this.urls['api']['ws'][type] + '/' + this.stream(type, 'multipleOHLCV');
|
|
@@ -1240,6 +1267,7 @@ class binance extends binance$1 {
|
|
|
1240
1267
|
const subscribe = {
|
|
1241
1268
|
'id': requestId,
|
|
1242
1269
|
};
|
|
1270
|
+
params = this.omit(params, 'callerMethodName');
|
|
1243
1271
|
const [symbol, timeframe, candles] = await this.watchMultiple(url, messageHashes, this.extend(request, params), messageHashes, subscribe);
|
|
1244
1272
|
if (this.newUpdates) {
|
|
1245
1273
|
limit = candles.getLimit(symbol, limit);
|
|
@@ -57,6 +57,7 @@ class bitfinex extends bitfinex$1 {
|
|
|
57
57
|
* @method
|
|
58
58
|
* @name bitfinex#watchTrades
|
|
59
59
|
* @description get the list of most recent trades for a particular symbol
|
|
60
|
+
* @see https://docs.bitfinex.com/v1/reference/ws-public-trades
|
|
60
61
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
61
62
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
62
63
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -76,6 +77,7 @@ class bitfinex extends bitfinex$1 {
|
|
|
76
77
|
* @method
|
|
77
78
|
* @name bitfinex#watchTicker
|
|
78
79
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
80
|
+
* @see https://docs.bitfinex.com/v1/reference/ws-public-ticker
|
|
79
81
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
80
82
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
81
83
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -248,6 +250,7 @@ class bitfinex extends bitfinex$1 {
|
|
|
248
250
|
* @method
|
|
249
251
|
* @name bitfinex#watchOrderBook
|
|
250
252
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
253
|
+
* @see https://docs.bitfinex.com/v1/reference/ws-public-order-books
|
|
251
254
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
252
255
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
253
256
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -458,6 +461,8 @@ class bitfinex extends bitfinex$1 {
|
|
|
458
461
|
* @method
|
|
459
462
|
* @name bitfinex#watchOrders
|
|
460
463
|
* @description watches information on multiple orders made by the user
|
|
464
|
+
* @see https://docs.bitfinex.com/v1/reference/ws-auth-order-updates
|
|
465
|
+
* @see https://docs.bitfinex.com/v1/reference/ws-auth-order-snapshots
|
|
461
466
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
462
467
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
463
468
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -1096,8 +1096,13 @@ class kucoin extends kucoin$1 {
|
|
|
1096
1096
|
const type = this.safeString(trade, 'orderType');
|
|
1097
1097
|
const side = this.safeString(trade, 'side');
|
|
1098
1098
|
const tradeId = this.safeString(trade, 'tradeId');
|
|
1099
|
-
|
|
1100
|
-
|
|
1099
|
+
let price = this.safeString(trade, 'matchPrice');
|
|
1100
|
+
let amount = this.safeString(trade, 'matchSize');
|
|
1101
|
+
if (price === undefined) {
|
|
1102
|
+
// /spot/tradeFills
|
|
1103
|
+
price = this.safeString(trade, 'price');
|
|
1104
|
+
amount = this.safeString(trade, 'size');
|
|
1105
|
+
}
|
|
1101
1106
|
const order = this.safeString(trade, 'orderId');
|
|
1102
1107
|
const timestamp = this.safeIntegerProduct2(trade, 'ts', 'time', 0.000001);
|
|
1103
1108
|
const feeCurrency = market['quote'];
|
package/dist/cjs/src/pro/woo.js
CHANGED
|
@@ -85,32 +85,49 @@ class woo extends woo$1 {
|
|
|
85
85
|
/**
|
|
86
86
|
* @method
|
|
87
87
|
* @name woo#watchOrderBook
|
|
88
|
+
* @see https://docs.woo.org/#orderbookupdate
|
|
88
89
|
* @see https://docs.woo.org/#orderbook
|
|
89
90
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
90
91
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
91
92
|
* @param {int} [limit] the maximum amount of order book entries to return.
|
|
92
93
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
94
|
+
* @param {string} [params.method] either (default) 'orderbook' or 'orderbookupdate', default is 'orderbook'
|
|
93
95
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
94
96
|
*/
|
|
95
97
|
await this.loadMarkets();
|
|
96
|
-
|
|
98
|
+
let method = undefined;
|
|
99
|
+
[method, params] = this.handleOptionAndParams(params, 'watchOrderBook', 'method', 'orderbook');
|
|
97
100
|
const market = this.market(symbol);
|
|
98
|
-
const topic = market['id'] + '@' +
|
|
101
|
+
const topic = market['id'] + '@' + method;
|
|
102
|
+
const urlUid = (this.uid) ? '/' + this.uid : '';
|
|
103
|
+
const url = this.urls['api']['ws']['public'] + urlUid;
|
|
104
|
+
const requestId = this.requestId(url);
|
|
99
105
|
const request = {
|
|
100
106
|
'event': 'subscribe',
|
|
101
107
|
'topic': topic,
|
|
108
|
+
'id': requestId,
|
|
102
109
|
};
|
|
103
|
-
const
|
|
104
|
-
|
|
110
|
+
const subscription = {
|
|
111
|
+
'id': requestId.toString(),
|
|
112
|
+
'name': method,
|
|
113
|
+
'symbol': symbol,
|
|
114
|
+
'limit': limit,
|
|
115
|
+
'params': params,
|
|
116
|
+
};
|
|
117
|
+
if (method === 'orderbookupdate') {
|
|
118
|
+
subscription['method'] = this.handleOrderBookSubscription;
|
|
119
|
+
}
|
|
120
|
+
const orderbook = await this.watch(url, topic, this.extend(request, params), topic, subscription);
|
|
105
121
|
return orderbook.limit();
|
|
106
122
|
}
|
|
107
123
|
handleOrderBook(client, message) {
|
|
108
124
|
//
|
|
109
125
|
// {
|
|
110
|
-
// "topic": "PERP_BTC_USDT@
|
|
111
|
-
// "ts":
|
|
126
|
+
// "topic": "PERP_BTC_USDT@orderbookupdate",
|
|
127
|
+
// "ts": 1722500373999,
|
|
112
128
|
// "data": {
|
|
113
129
|
// "symbol": "PERP_BTC_USDT",
|
|
130
|
+
// "prevTs": 1722500373799,
|
|
114
131
|
// "bids": [
|
|
115
132
|
// [
|
|
116
133
|
// 0.30891,
|
|
@@ -131,14 +148,106 @@ class woo extends woo$1 {
|
|
|
131
148
|
const market = this.safeMarket(marketId);
|
|
132
149
|
const symbol = market['symbol'];
|
|
133
150
|
const topic = this.safeString(message, 'topic');
|
|
134
|
-
|
|
135
|
-
|
|
151
|
+
const method = this.safeString(topic.split('@'), 1);
|
|
152
|
+
if (method === 'orderbookupdate') {
|
|
153
|
+
if (!(symbol in this.orderbooks)) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const orderbook = this.orderbooks[symbol];
|
|
157
|
+
const timestamp = this.safeInteger(orderbook, 'timestamp');
|
|
158
|
+
if (timestamp === undefined) {
|
|
159
|
+
orderbook.cache.push(message);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
try {
|
|
163
|
+
const ts = this.safeInteger(message, 'ts');
|
|
164
|
+
if (ts > timestamp) {
|
|
165
|
+
this.handleOrderBookMessage(client, message, orderbook);
|
|
166
|
+
client.resolve(orderbook, topic);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
catch (e) {
|
|
170
|
+
delete this.orderbooks[symbol];
|
|
171
|
+
delete client.subscriptions[topic];
|
|
172
|
+
client.reject(e, topic);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
if (!(symbol in this.orderbooks)) {
|
|
178
|
+
const defaultLimit = this.safeInteger(this.options, 'watchOrderBookLimit', 1000);
|
|
179
|
+
const subscription = client.subscriptions[topic];
|
|
180
|
+
const limit = this.safeInteger(subscription, 'limit', defaultLimit);
|
|
181
|
+
this.orderbooks[symbol] = this.orderBook({}, limit);
|
|
182
|
+
}
|
|
183
|
+
const orderbook = this.orderbooks[symbol];
|
|
184
|
+
const timestamp = this.safeInteger(message, 'ts');
|
|
185
|
+
const snapshot = this.parseOrderBook(data, symbol, timestamp, 'bids', 'asks');
|
|
186
|
+
orderbook.reset(snapshot);
|
|
187
|
+
client.resolve(orderbook, topic);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
handleOrderBookSubscription(client, message, subscription) {
|
|
191
|
+
const defaultLimit = this.safeInteger(this.options, 'watchOrderBookLimit', 1000);
|
|
192
|
+
const limit = this.safeInteger(subscription, 'limit', defaultLimit);
|
|
193
|
+
const symbol = this.safeString(subscription, 'symbol'); // watchOrderBook
|
|
194
|
+
if (symbol in this.orderbooks) {
|
|
195
|
+
delete this.orderbooks[symbol];
|
|
136
196
|
}
|
|
137
|
-
|
|
197
|
+
this.orderbooks[symbol] = this.orderBook({}, limit);
|
|
198
|
+
this.spawn(this.fetchOrderBookSnapshot, client, message, subscription);
|
|
199
|
+
}
|
|
200
|
+
async fetchOrderBookSnapshot(client, message, subscription) {
|
|
201
|
+
const symbol = this.safeString(subscription, 'symbol');
|
|
202
|
+
const messageHash = this.safeString(message, 'topic');
|
|
203
|
+
try {
|
|
204
|
+
const defaultLimit = this.safeInteger(this.options, 'watchOrderBookLimit', 1000);
|
|
205
|
+
const limit = this.safeInteger(subscription, 'limit', defaultLimit);
|
|
206
|
+
const params = this.safeValue(subscription, 'params');
|
|
207
|
+
const snapshot = await this.fetchRestOrderBookSafe(symbol, limit, params);
|
|
208
|
+
if (this.safeValue(this.orderbooks, symbol) === undefined) {
|
|
209
|
+
// if the orderbook is dropped before the snapshot is received
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const orderbook = this.orderbooks[symbol];
|
|
213
|
+
orderbook.reset(snapshot);
|
|
214
|
+
const messages = orderbook.cache;
|
|
215
|
+
for (let i = 0; i < messages.length; i++) {
|
|
216
|
+
const messageItem = messages[i];
|
|
217
|
+
const ts = this.safeInteger(messageItem, 'ts');
|
|
218
|
+
if (ts < orderbook['timestamp']) {
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
this.handleOrderBookMessage(client, messageItem, orderbook);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
this.orderbooks[symbol] = orderbook;
|
|
226
|
+
client.resolve(orderbook, messageHash);
|
|
227
|
+
}
|
|
228
|
+
catch (e) {
|
|
229
|
+
delete client.subscriptions[messageHash];
|
|
230
|
+
client.reject(e, messageHash);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
handleOrderBookMessage(client, message, orderbook) {
|
|
234
|
+
const data = this.safeDict(message, 'data');
|
|
235
|
+
this.handleDeltas(orderbook['asks'], this.safeValue(data, 'asks', []));
|
|
236
|
+
this.handleDeltas(orderbook['bids'], this.safeValue(data, 'bids', []));
|
|
138
237
|
const timestamp = this.safeInteger(message, 'ts');
|
|
139
|
-
|
|
140
|
-
orderbook.
|
|
141
|
-
|
|
238
|
+
orderbook['timestamp'] = timestamp;
|
|
239
|
+
orderbook['datetime'] = this.iso8601(timestamp);
|
|
240
|
+
return orderbook;
|
|
241
|
+
}
|
|
242
|
+
handleDelta(bookside, delta) {
|
|
243
|
+
const price = this.safeFloat2(delta, 'price', 0);
|
|
244
|
+
const amount = this.safeFloat2(delta, 'quantity', 1);
|
|
245
|
+
bookside.store(price, amount);
|
|
246
|
+
}
|
|
247
|
+
handleDeltas(bookside, deltas) {
|
|
248
|
+
for (let i = 0; i < deltas.length; i++) {
|
|
249
|
+
this.handleDelta(bookside, deltas[i]);
|
|
250
|
+
}
|
|
142
251
|
}
|
|
143
252
|
async watchTicker(symbol, params = {}) {
|
|
144
253
|
/**
|
|
@@ -1061,6 +1170,7 @@ class woo extends woo$1 {
|
|
|
1061
1170
|
'pong': this.handlePong,
|
|
1062
1171
|
'subscribe': this.handleSubscribe,
|
|
1063
1172
|
'orderbook': this.handleOrderBook,
|
|
1173
|
+
'orderbookupdate': this.handleOrderBook,
|
|
1064
1174
|
'ticker': this.handleTicker,
|
|
1065
1175
|
'tickers': this.handleTickers,
|
|
1066
1176
|
'kline': this.handleOHLCV,
|
|
@@ -1126,6 +1236,13 @@ class woo extends woo$1 {
|
|
|
1126
1236
|
// "ts": 1657117712212
|
|
1127
1237
|
// }
|
|
1128
1238
|
//
|
|
1239
|
+
const id = this.safeString(message, 'id');
|
|
1240
|
+
const subscriptionsById = this.indexBy(client.subscriptions, 'id');
|
|
1241
|
+
const subscription = this.safeValue(subscriptionsById, id, {});
|
|
1242
|
+
const method = this.safeValue(subscription, 'method');
|
|
1243
|
+
if (method !== undefined) {
|
|
1244
|
+
method.call(this, client, message, subscription);
|
|
1245
|
+
}
|
|
1129
1246
|
return message;
|
|
1130
1247
|
}
|
|
1131
1248
|
handleAuth(client, message) {
|
package/dist/cjs/src/woo.js
CHANGED
|
@@ -144,7 +144,7 @@ class woo extends woo$1 {
|
|
|
144
144
|
'https://support.woo.org/hc/en-001/articles/4404611795353--Trading-Fees',
|
|
145
145
|
],
|
|
146
146
|
'referral': {
|
|
147
|
-
'url': 'https://x.woo.org/register?ref=
|
|
147
|
+
'url': 'https://x.woo.org/register?ref=DIJT0CNL',
|
|
148
148
|
'discount': 0.35,
|
|
149
149
|
},
|
|
150
150
|
},
|
package/dist/cjs/src/yobit.js
CHANGED
|
@@ -547,6 +547,22 @@ class yobit extends yobit$1 {
|
|
|
547
547
|
'info': ticker,
|
|
548
548
|
}, market);
|
|
549
549
|
}
|
|
550
|
+
async fetchTickersHelper(idsString, params = {}) {
|
|
551
|
+
const request = {
|
|
552
|
+
'pair': idsString,
|
|
553
|
+
};
|
|
554
|
+
const tickers = await this.publicGetTickerPair(this.extend(request, params));
|
|
555
|
+
const result = {};
|
|
556
|
+
const keys = Object.keys(tickers);
|
|
557
|
+
for (let k = 0; k < keys.length; k++) {
|
|
558
|
+
const id = keys[k];
|
|
559
|
+
const ticker = tickers[id];
|
|
560
|
+
const market = this.safeMarket(id);
|
|
561
|
+
const symbol = market['symbol'];
|
|
562
|
+
result[symbol] = this.parseTicker(ticker, market);
|
|
563
|
+
}
|
|
564
|
+
return result;
|
|
565
|
+
}
|
|
550
566
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
551
567
|
/**
|
|
552
568
|
* @method
|
|
@@ -555,43 +571,53 @@ class yobit extends yobit$1 {
|
|
|
555
571
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
556
572
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
557
573
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
574
|
+
* @param {object} [params.all] you can set to `true` for convenience to fetch all tickers from this exchange by sending multiple requests
|
|
558
575
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
559
576
|
*/
|
|
560
|
-
|
|
561
|
-
|
|
577
|
+
let allSymbols = undefined;
|
|
578
|
+
[allSymbols, params] = this.handleParamBool(params, 'all', false);
|
|
579
|
+
if (symbols === undefined && !allSymbols) {
|
|
580
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchTickers() requires "symbols" argument or use `params["all"] = true` to send multiple requests for all markets');
|
|
562
581
|
}
|
|
563
582
|
await this.loadMarkets();
|
|
564
|
-
|
|
565
|
-
let ids = undefined;
|
|
566
|
-
if (symbols === undefined) {
|
|
567
|
-
ids = this.ids;
|
|
568
|
-
}
|
|
569
|
-
else {
|
|
570
|
-
ids = this.marketIds(symbols);
|
|
571
|
-
}
|
|
572
|
-
const idsLength = ids.length;
|
|
573
|
-
const idsString = ids.join('-');
|
|
583
|
+
const promises = [];
|
|
574
584
|
const maxLength = this.safeInteger(this.options, 'maxUrlLength', 2048);
|
|
575
585
|
// max URL length is 2048 symbols, including http schema, hostname, tld, etc...
|
|
576
|
-
const lenghtOfBaseUrl =
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
586
|
+
const lenghtOfBaseUrl = 40; // safe space for the url including api-base and endpoint dir is 30 chars
|
|
587
|
+
if (allSymbols) {
|
|
588
|
+
symbols = this.symbols;
|
|
589
|
+
let ids = '';
|
|
590
|
+
for (let i = 0; i < this.ids.length; i++) {
|
|
591
|
+
const id = this.ids[i];
|
|
592
|
+
const prefix = (ids === '') ? '' : '-';
|
|
593
|
+
ids += prefix + id;
|
|
594
|
+
if (ids.length > maxLength) {
|
|
595
|
+
promises.push(this.fetchTickersHelper(ids, params));
|
|
596
|
+
ids = '';
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
if (ids !== '') {
|
|
600
|
+
promises.push(this.fetchTickersHelper(ids, params));
|
|
601
|
+
}
|
|
580
602
|
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
603
|
+
else {
|
|
604
|
+
symbols = this.marketSymbols(symbols);
|
|
605
|
+
const ids = this.marketIds(symbols);
|
|
606
|
+
const idsLength = ids.length;
|
|
607
|
+
const idsString = ids.join('-');
|
|
608
|
+
const actualLength = idsString.length + lenghtOfBaseUrl;
|
|
609
|
+
if (actualLength > maxLength) {
|
|
610
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchTickers() is being requested for ' + idsLength.toString() + ' markets (which has an URL length of ' + actualLength.toString() + ' characters), but it exceedes max URL length (' + maxLength.toString() + '), please pass limisted symbols array to fetchTickers to fit in one request');
|
|
611
|
+
}
|
|
612
|
+
promises.push(this.fetchTickersHelper(idsString, params));
|
|
613
|
+
}
|
|
614
|
+
const resultAll = await Promise.all(promises);
|
|
615
|
+
let finalResult = {};
|
|
616
|
+
for (let i = 0; i < resultAll.length; i++) {
|
|
617
|
+
const result = this.filterByArrayTickers(resultAll[i], 'symbol', symbols);
|
|
618
|
+
finalResult = this.extend(finalResult, result);
|
|
593
619
|
}
|
|
594
|
-
return
|
|
620
|
+
return finalResult;
|
|
595
621
|
}
|
|
596
622
|
async fetchTicker(symbol, params = {}) {
|
|
597
623
|
/**
|
package/examples/js/cli.js
CHANGED
|
@@ -38,6 +38,7 @@ let [processPath, , exchangeId, methodName, ... params] = process.argv.filter (x
|
|
|
38
38
|
, shouldCreateResponseReport = process.argv.includes ('--response')
|
|
39
39
|
, shouldCreateBoth = process.argv.includes ('--static')
|
|
40
40
|
, raw = process.argv.includes ('--raw')
|
|
41
|
+
, noKeys = process.argv.includes ('--no-keys')
|
|
41
42
|
|
|
42
43
|
//-----------------------------------------------------------------------------
|
|
43
44
|
if (!raw) {
|
|
@@ -107,17 +108,19 @@ try {
|
|
|
107
108
|
exchange.options['defaultType'] = 'option';
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (credentialValue
|
|
118
|
-
|
|
111
|
+
if (!noKeys) {
|
|
112
|
+
// check auth keys in env var
|
|
113
|
+
const requiredCredentials = exchange.requiredCredentials;
|
|
114
|
+
for (const [credential, isRequired] of Object.entries (requiredCredentials)) {
|
|
115
|
+
if (isRequired && exchange[credential] === undefined) {
|
|
116
|
+
const credentialEnvName = (exchangeId + '_' + credential).toUpperCase () // example: KRAKEN_APIKEY
|
|
117
|
+
let credentialValue = process.env[credentialEnvName]
|
|
118
|
+
if (credentialValue) {
|
|
119
|
+
if (credentialValue.indexOf('---BEGIN') > -1) {
|
|
120
|
+
credentialValue = credentialValue.replaceAll('\\n', '\n');
|
|
121
|
+
}
|
|
122
|
+
exchange[credential] = credentialValue
|
|
119
123
|
}
|
|
120
|
-
exchange[credential] = credentialValue
|
|
121
124
|
}
|
|
122
125
|
}
|
|
123
126
|
}
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.3.
|
|
7
|
+
declare const version = "4.3.73";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.3.
|
|
41
|
+
const version = '4.3.74';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -522,6 +522,8 @@ interface Exchange {
|
|
|
522
522
|
fapiPrivateGetTradeAsyn(params?: {}): Promise<implicitReturnType>;
|
|
523
523
|
fapiPrivateGetTradeAsynId(params?: {}): Promise<implicitReturnType>;
|
|
524
524
|
fapiPrivateGetFeeBurn(params?: {}): Promise<implicitReturnType>;
|
|
525
|
+
fapiPrivateGetSymbolConfig(params?: {}): Promise<implicitReturnType>;
|
|
526
|
+
fapiPrivateGetAccountConfig(params?: {}): Promise<implicitReturnType>;
|
|
525
527
|
fapiPrivatePostBatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
526
528
|
fapiPrivatePostPositionSideDual(params?: {}): Promise<implicitReturnType>;
|
|
527
529
|
fapiPrivatePostPositionMargin(params?: {}): Promise<implicitReturnType>;
|
|
@@ -545,6 +547,9 @@ interface Exchange {
|
|
|
545
547
|
fapiPrivateV2GetAccount(params?: {}): Promise<implicitReturnType>;
|
|
546
548
|
fapiPrivateV2GetBalance(params?: {}): Promise<implicitReturnType>;
|
|
547
549
|
fapiPrivateV2GetPositionRisk(params?: {}): Promise<implicitReturnType>;
|
|
550
|
+
fapiPrivateV3GetAccount(params?: {}): Promise<implicitReturnType>;
|
|
551
|
+
fapiPrivateV3GetBalance(params?: {}): Promise<implicitReturnType>;
|
|
552
|
+
fapiPrivateV3GetPositionRisk(params?: {}): Promise<implicitReturnType>;
|
|
548
553
|
eapiPublicGetPing(params?: {}): Promise<implicitReturnType>;
|
|
549
554
|
eapiPublicGetTime(params?: {}): Promise<implicitReturnType>;
|
|
550
555
|
eapiPublicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
|
|
@@ -522,6 +522,8 @@ interface binance {
|
|
|
522
522
|
fapiPrivateGetTradeAsyn(params?: {}): Promise<implicitReturnType>;
|
|
523
523
|
fapiPrivateGetTradeAsynId(params?: {}): Promise<implicitReturnType>;
|
|
524
524
|
fapiPrivateGetFeeBurn(params?: {}): Promise<implicitReturnType>;
|
|
525
|
+
fapiPrivateGetSymbolConfig(params?: {}): Promise<implicitReturnType>;
|
|
526
|
+
fapiPrivateGetAccountConfig(params?: {}): Promise<implicitReturnType>;
|
|
525
527
|
fapiPrivatePostBatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
526
528
|
fapiPrivatePostPositionSideDual(params?: {}): Promise<implicitReturnType>;
|
|
527
529
|
fapiPrivatePostPositionMargin(params?: {}): Promise<implicitReturnType>;
|
|
@@ -545,6 +547,9 @@ interface binance {
|
|
|
545
547
|
fapiPrivateV2GetAccount(params?: {}): Promise<implicitReturnType>;
|
|
546
548
|
fapiPrivateV2GetBalance(params?: {}): Promise<implicitReturnType>;
|
|
547
549
|
fapiPrivateV2GetPositionRisk(params?: {}): Promise<implicitReturnType>;
|
|
550
|
+
fapiPrivateV3GetAccount(params?: {}): Promise<implicitReturnType>;
|
|
551
|
+
fapiPrivateV3GetBalance(params?: {}): Promise<implicitReturnType>;
|
|
552
|
+
fapiPrivateV3GetPositionRisk(params?: {}): Promise<implicitReturnType>;
|
|
548
553
|
eapiPublicGetPing(params?: {}): Promise<implicitReturnType>;
|
|
549
554
|
eapiPublicGetTime(params?: {}): Promise<implicitReturnType>;
|
|
550
555
|
eapiPublicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
|
|
@@ -574,6 +574,8 @@ interface binance {
|
|
|
574
574
|
fapiPrivateGetTradeAsyn(params?: {}): Promise<implicitReturnType>;
|
|
575
575
|
fapiPrivateGetTradeAsynId(params?: {}): Promise<implicitReturnType>;
|
|
576
576
|
fapiPrivateGetFeeBurn(params?: {}): Promise<implicitReturnType>;
|
|
577
|
+
fapiPrivateGetSymbolConfig(params?: {}): Promise<implicitReturnType>;
|
|
578
|
+
fapiPrivateGetAccountConfig(params?: {}): Promise<implicitReturnType>;
|
|
577
579
|
fapiPrivatePostBatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
578
580
|
fapiPrivatePostPositionSideDual(params?: {}): Promise<implicitReturnType>;
|
|
579
581
|
fapiPrivatePostPositionMargin(params?: {}): Promise<implicitReturnType>;
|
|
@@ -597,6 +599,9 @@ interface binance {
|
|
|
597
599
|
fapiPrivateV2GetAccount(params?: {}): Promise<implicitReturnType>;
|
|
598
600
|
fapiPrivateV2GetBalance(params?: {}): Promise<implicitReturnType>;
|
|
599
601
|
fapiPrivateV2GetPositionRisk(params?: {}): Promise<implicitReturnType>;
|
|
602
|
+
fapiPrivateV3GetAccount(params?: {}): Promise<implicitReturnType>;
|
|
603
|
+
fapiPrivateV3GetBalance(params?: {}): Promise<implicitReturnType>;
|
|
604
|
+
fapiPrivateV3GetPositionRisk(params?: {}): Promise<implicitReturnType>;
|
|
600
605
|
eapiPublicGetPing(params?: {}): Promise<implicitReturnType>;
|
|
601
606
|
eapiPublicGetTime(params?: {}): Promise<implicitReturnType>;
|
|
602
607
|
eapiPublicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
|
|
@@ -522,6 +522,8 @@ interface binance {
|
|
|
522
522
|
fapiPrivateGetTradeAsyn(params?: {}): Promise<implicitReturnType>;
|
|
523
523
|
fapiPrivateGetTradeAsynId(params?: {}): Promise<implicitReturnType>;
|
|
524
524
|
fapiPrivateGetFeeBurn(params?: {}): Promise<implicitReturnType>;
|
|
525
|
+
fapiPrivateGetSymbolConfig(params?: {}): Promise<implicitReturnType>;
|
|
526
|
+
fapiPrivateGetAccountConfig(params?: {}): Promise<implicitReturnType>;
|
|
525
527
|
fapiPrivatePostBatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
526
528
|
fapiPrivatePostPositionSideDual(params?: {}): Promise<implicitReturnType>;
|
|
527
529
|
fapiPrivatePostPositionMargin(params?: {}): Promise<implicitReturnType>;
|
|
@@ -545,6 +547,9 @@ interface binance {
|
|
|
545
547
|
fapiPrivateV2GetAccount(params?: {}): Promise<implicitReturnType>;
|
|
546
548
|
fapiPrivateV2GetBalance(params?: {}): Promise<implicitReturnType>;
|
|
547
549
|
fapiPrivateV2GetPositionRisk(params?: {}): Promise<implicitReturnType>;
|
|
550
|
+
fapiPrivateV3GetAccount(params?: {}): Promise<implicitReturnType>;
|
|
551
|
+
fapiPrivateV3GetBalance(params?: {}): Promise<implicitReturnType>;
|
|
552
|
+
fapiPrivateV3GetPositionRisk(params?: {}): Promise<implicitReturnType>;
|
|
548
553
|
eapiPublicGetPing(params?: {}): Promise<implicitReturnType>;
|
|
549
554
|
eapiPublicGetTime(params?: {}): Promise<implicitReturnType>;
|
|
550
555
|
eapiPublicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
|
package/js/src/ace.js
CHANGED
|
@@ -355,7 +355,7 @@ export default class ace extends Exchange {
|
|
|
355
355
|
for (let i = 0; i < pairs.length; i++) {
|
|
356
356
|
const marketId = pairs[i];
|
|
357
357
|
const market = this.safeMarket(marketId);
|
|
358
|
-
const rawTicker = this.safeDict(response, marketId);
|
|
358
|
+
const rawTicker = this.safeDict(response, marketId, {});
|
|
359
359
|
const ticker = this.parseTicker(rawTicker, market);
|
|
360
360
|
tickers.push(ticker);
|
|
361
361
|
}
|
package/js/src/base/ws/Client.js
CHANGED
|
@@ -11,7 +11,7 @@ import { isNode, isJsonEncodedObject, deepExtend, milliseconds, } from '../../ba
|
|
|
11
11
|
import { utf8 } from '../../static_dependencies/scure-base/index.js';
|
|
12
12
|
export default class Client {
|
|
13
13
|
constructor(url, onMessageCallback, onErrorCallback, onCloseCallback, onConnectedCallback, config = {}) {
|
|
14
|
-
this.useMessageQueue =
|
|
14
|
+
this.useMessageQueue = false;
|
|
15
15
|
this.verbose = false;
|
|
16
16
|
const defaults = {
|
|
17
17
|
url,
|
|
@@ -26,7 +26,7 @@ export default class Client {
|
|
|
26
26
|
subscriptions: {},
|
|
27
27
|
rejections: {},
|
|
28
28
|
messageQueue: {},
|
|
29
|
-
useMessageQueue:
|
|
29
|
+
useMessageQueue: false,
|
|
30
30
|
connected: undefined,
|
|
31
31
|
error: undefined,
|
|
32
32
|
connectionStarted: undefined,
|