ccxt 4.0.107 → 4.0.108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.js +334 -257
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +15 -13
- package/dist/cjs/src/binance.js +5 -8
- package/dist/cjs/src/bitforex.js +9 -0
- package/dist/cjs/src/exmo.js +6 -6
- package/dist/cjs/src/pro/bitget.js +5 -5
- package/dist/cjs/src/pro/bybit.js +3 -3
- package/dist/cjs/src/pro/woo.js +69 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +2 -5
- package/js/src/abstract/binancecoinm.d.ts +2 -5
- package/js/src/abstract/binanceus.d.ts +2 -5
- package/js/src/abstract/binanceusdm.d.ts +2 -5
- package/js/src/base/Exchange.d.ts +1 -1
- package/js/src/base/Exchange.js +14 -13
- package/js/src/binance.js +5 -8
- package/js/src/bitforex.js +9 -0
- package/js/src/exmo.js +6 -6
- package/js/src/pro/bitget.js +5 -5
- package/js/src/pro/bybit.js +3 -3
- package/js/src/pro/woo.d.ts +2 -0
- package/js/src/pro/woo.js +69 -1
- package/package.json +1 -1
package/js/src/bitforex.js
CHANGED
|
@@ -159,6 +159,7 @@ export default class bitforex extends Exchange {
|
|
|
159
159
|
* @method
|
|
160
160
|
* @name bitforex#fetchMarkets
|
|
161
161
|
* @description retrieves data on all markets for bitforex
|
|
162
|
+
* @see https://apidoc.bitforex.com/#exchange-information
|
|
162
163
|
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
163
164
|
* @returns {object[]} an array of objects representing market data
|
|
164
165
|
*/
|
|
@@ -314,6 +315,7 @@ export default class bitforex extends Exchange {
|
|
|
314
315
|
* @method
|
|
315
316
|
* @name bitforex#fetchTrades
|
|
316
317
|
* @description get the list of most recent trades for a particular symbol
|
|
318
|
+
* @see https://apidoc.bitforex.com/#recent-trades-list
|
|
317
319
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
318
320
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
319
321
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -426,6 +428,7 @@ export default class bitforex extends Exchange {
|
|
|
426
428
|
* @method
|
|
427
429
|
* @name bitforex#fetchBalance
|
|
428
430
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
431
|
+
* @see https://apidoc.bitforex.com/#user-all-asset-information-user_data
|
|
429
432
|
* @param {object} [params] extra parameters specific to the bitforex api endpoint
|
|
430
433
|
* @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
|
|
431
434
|
*/
|
|
@@ -475,6 +478,7 @@ export default class bitforex extends Exchange {
|
|
|
475
478
|
* @method
|
|
476
479
|
* @name bitforex#fetchTicker
|
|
477
480
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
481
|
+
* @see https://apidoc.bitforex.com/#exchange-information
|
|
478
482
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
479
483
|
* @param {object} [params] extra parameters specific to the bitforex api endpoint
|
|
480
484
|
* @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
|
|
@@ -529,6 +533,7 @@ export default class bitforex extends Exchange {
|
|
|
529
533
|
* @method
|
|
530
534
|
* @name bitforex#fetchOHLCV
|
|
531
535
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
536
|
+
* @see https://apidoc.bitforex.com/#kline
|
|
532
537
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
533
538
|
* @param {string} timeframe the length of time each candle represents
|
|
534
539
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -565,6 +570,7 @@ export default class bitforex extends Exchange {
|
|
|
565
570
|
* @method
|
|
566
571
|
* @name bitforex#fetchOrderBook
|
|
567
572
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
573
|
+
* @see https://apidoc.bitforex.com/#order-book
|
|
568
574
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
569
575
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
570
576
|
* @param {object} [params] extra parameters specific to the bitforex api endpoint
|
|
@@ -653,6 +659,7 @@ export default class bitforex extends Exchange {
|
|
|
653
659
|
* @method
|
|
654
660
|
* @name bitforex#fetchOrder
|
|
655
661
|
* @description fetches information on an order made by the user
|
|
662
|
+
* @see
|
|
656
663
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
657
664
|
* @param {object} [params] extra parameters specific to the bitforex api endpoint
|
|
658
665
|
* @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
@@ -718,6 +725,7 @@ export default class bitforex extends Exchange {
|
|
|
718
725
|
* @method
|
|
719
726
|
* @name bitforex#createOrder
|
|
720
727
|
* @description create a trade order
|
|
728
|
+
* @see https://apidoc.bitforex.com/#new-order-trade
|
|
721
729
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
722
730
|
* @param {string} type 'market' or 'limit'
|
|
723
731
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -753,6 +761,7 @@ export default class bitforex extends Exchange {
|
|
|
753
761
|
* @method
|
|
754
762
|
* @name bitforex#cancelOrder
|
|
755
763
|
* @description cancels an open order
|
|
764
|
+
* @see https://apidoc.bitforex.com/#cancel-order-trade
|
|
756
765
|
* @param {string} id order id
|
|
757
766
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
758
767
|
* @param {object} [params] extra parameters specific to the bitforex api endpoint
|
package/js/src/exmo.js
CHANGED
|
@@ -1751,11 +1751,11 @@ export default class exmo extends Exchange {
|
|
|
1751
1751
|
const marketIds = Object.keys(response);
|
|
1752
1752
|
for (let i = 0; i < marketIds.length; i++) {
|
|
1753
1753
|
const marketId = marketIds[i];
|
|
1754
|
-
const
|
|
1754
|
+
const marketInner = this.safeMarket(marketId);
|
|
1755
1755
|
params = this.extend(params, {
|
|
1756
1756
|
'status': 'open',
|
|
1757
1757
|
});
|
|
1758
|
-
const parsedOrders = this.parseOrders(response[marketId],
|
|
1758
|
+
const parsedOrders = this.parseOrders(response[marketId], marketInner, since, limit, params);
|
|
1759
1759
|
orders = this.arrayConcat(orders, parsedOrders);
|
|
1760
1760
|
}
|
|
1761
1761
|
}
|
|
@@ -1958,8 +1958,8 @@ export default class exmo extends Exchange {
|
|
|
1958
1958
|
}
|
|
1959
1959
|
const isSpot = (marginMode !== 'isolated');
|
|
1960
1960
|
if (symbol !== undefined) {
|
|
1961
|
-
const
|
|
1962
|
-
symbol =
|
|
1961
|
+
const marketInner = this.market(symbol);
|
|
1962
|
+
symbol = marketInner['symbol'];
|
|
1963
1963
|
}
|
|
1964
1964
|
const request = {
|
|
1965
1965
|
'limit': limit,
|
|
@@ -1993,7 +1993,7 @@ export default class exmo extends Exchange {
|
|
|
1993
1993
|
return this.parseOrders(response, market, since, limit, params);
|
|
1994
1994
|
}
|
|
1995
1995
|
else {
|
|
1996
|
-
const
|
|
1996
|
+
const responseSwap = await this.privatePostMarginUserOrderHistory(this.extend(request, params));
|
|
1997
1997
|
//
|
|
1998
1998
|
// {
|
|
1999
1999
|
// "items": [
|
|
@@ -2018,7 +2018,7 @@ export default class exmo extends Exchange {
|
|
|
2018
2018
|
// ]
|
|
2019
2019
|
// }
|
|
2020
2020
|
//
|
|
2021
|
-
const items = this.safeValue(
|
|
2021
|
+
const items = this.safeValue(responseSwap, 'items');
|
|
2022
2022
|
const orders = this.parseOrders(items, market, since, limit, params);
|
|
2023
2023
|
const result = [];
|
|
2024
2024
|
for (let i = 0; i < orders.length; i++) {
|
package/js/src/pro/bitget.js
CHANGED
|
@@ -149,11 +149,11 @@ export default class bitget extends bitgetRest {
|
|
|
149
149
|
const topics = [];
|
|
150
150
|
for (let i = 0; i < marketIds.length; i++) {
|
|
151
151
|
const marketId = marketIds[i];
|
|
152
|
-
const
|
|
152
|
+
const marketInner = this.market(marketId);
|
|
153
153
|
const args = {
|
|
154
154
|
'instType': instType,
|
|
155
155
|
'channel': 'ticker',
|
|
156
|
-
'instId': this.getWsMarketId(
|
|
156
|
+
'instId': this.getWsMarketId(marketInner),
|
|
157
157
|
};
|
|
158
158
|
topics.push(args);
|
|
159
159
|
}
|
|
@@ -193,12 +193,12 @@ export default class bitget extends bitgetRest {
|
|
|
193
193
|
// watchTickers part
|
|
194
194
|
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
195
195
|
for (let i = 0; i < messageHashes.length; i++) {
|
|
196
|
-
const
|
|
197
|
-
const parts =
|
|
196
|
+
const messageHashTicker = messageHashes[i];
|
|
197
|
+
const parts = messageHashTicker.split('::');
|
|
198
198
|
const symbolsString = parts[1];
|
|
199
199
|
const symbols = symbolsString.split(',');
|
|
200
200
|
if (this.inArray(symbol, symbols)) {
|
|
201
|
-
client.resolve(ticker,
|
|
201
|
+
client.resolve(ticker, messageHashTicker);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
return message;
|
package/js/src/pro/bybit.js
CHANGED
|
@@ -348,12 +348,12 @@ export default class bybit extends bybitRest {
|
|
|
348
348
|
// watchTickers part
|
|
349
349
|
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
350
350
|
for (let i = 0; i < messageHashes.length; i++) {
|
|
351
|
-
const
|
|
352
|
-
const parts =
|
|
351
|
+
const messageHashTicker = messageHashes[i];
|
|
352
|
+
const parts = messageHashTicker.split('::');
|
|
353
353
|
const symbolsString = parts[1];
|
|
354
354
|
const symbols = symbolsString.split(',');
|
|
355
355
|
if (this.inArray(parsed['symbol'], symbols)) {
|
|
356
|
-
client.resolve(parsed,
|
|
356
|
+
client.resolve(parsed, messageHashTicker);
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
}
|
package/js/src/pro/woo.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export default class woo extends wooRest {
|
|
|
24
24
|
parseWsOrder(order: any, market?: any): import("../base/types.js").Order;
|
|
25
25
|
handleOrderUpdate(client: Client, message: any): void;
|
|
26
26
|
handleOrder(client: Client, message: any): void;
|
|
27
|
+
watchBalance(params?: {}): Promise<any>;
|
|
28
|
+
handleBalance(client: any, message: any): void;
|
|
27
29
|
handleMessage(client: Client, message: any): any;
|
|
28
30
|
ping(client: any): {
|
|
29
31
|
event: string;
|
package/js/src/pro/woo.js
CHANGED
|
@@ -16,7 +16,7 @@ export default class woo extends wooRest {
|
|
|
16
16
|
return this.deepExtend(super.describe(), {
|
|
17
17
|
'has': {
|
|
18
18
|
'ws': true,
|
|
19
|
-
'watchBalance':
|
|
19
|
+
'watchBalance': true,
|
|
20
20
|
'watchMyTrades': false,
|
|
21
21
|
'watchOHLCV': true,
|
|
22
22
|
'watchOrderBook': true,
|
|
@@ -607,6 +607,73 @@ export default class woo extends wooRest {
|
|
|
607
607
|
client.resolve(this.orders, messageHashSymbol);
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
+
async watchBalance(params = {}) {
|
|
611
|
+
/**
|
|
612
|
+
* @method
|
|
613
|
+
* @see https://docs.woo.org/#balance
|
|
614
|
+
* @name woo#watchBalance
|
|
615
|
+
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
616
|
+
* @param {object} [params] extra parameters specific to the woo api endpoint
|
|
617
|
+
* @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
|
|
618
|
+
*/
|
|
619
|
+
await this.loadMarkets();
|
|
620
|
+
const topic = 'balance';
|
|
621
|
+
const messageHash = topic;
|
|
622
|
+
const request = {
|
|
623
|
+
'event': 'subscribe',
|
|
624
|
+
'topic': topic,
|
|
625
|
+
};
|
|
626
|
+
const message = this.extend(request, params);
|
|
627
|
+
return await this.watchPrivate(messageHash, message);
|
|
628
|
+
}
|
|
629
|
+
handleBalance(client, message) {
|
|
630
|
+
//
|
|
631
|
+
// {
|
|
632
|
+
// "topic": "balance",
|
|
633
|
+
// "ts": 1695716888789,
|
|
634
|
+
// "data": {
|
|
635
|
+
// "balances": {
|
|
636
|
+
// "USDT": {
|
|
637
|
+
// "holding": 266.56059176,
|
|
638
|
+
// "frozen": 0,
|
|
639
|
+
// "interest": 0,
|
|
640
|
+
// "pendingShortQty": 0,
|
|
641
|
+
// "pendingExposure": 0,
|
|
642
|
+
// "pendingLongQty": 0,
|
|
643
|
+
// "pendingLongExposure": 0,
|
|
644
|
+
// "version": 37,
|
|
645
|
+
// "staked": 0,
|
|
646
|
+
// "unbonding": 0,
|
|
647
|
+
// "vault": 0,
|
|
648
|
+
// "averageOpenPrice": 0,
|
|
649
|
+
// "pnl24H": 0,
|
|
650
|
+
// "fee24H": 0,
|
|
651
|
+
// "markPrice": 1,
|
|
652
|
+
// "pnl24HPercentage": 0
|
|
653
|
+
// }
|
|
654
|
+
// }
|
|
655
|
+
//
|
|
656
|
+
// }
|
|
657
|
+
//
|
|
658
|
+
const data = this.safeValue(message, 'data');
|
|
659
|
+
const balances = this.safeValue(data, 'balances');
|
|
660
|
+
const keys = Object.keys(balances);
|
|
661
|
+
const ts = this.safeInteger(message, 'ts');
|
|
662
|
+
this.balance['info'] = data;
|
|
663
|
+
this.balance['timestamp'] = ts;
|
|
664
|
+
this.balance['datetime'] = this.iso8601(ts);
|
|
665
|
+
for (let i = 0; i < keys.length; i++) {
|
|
666
|
+
const key = keys[i];
|
|
667
|
+
const value = balances[key];
|
|
668
|
+
const code = this.safeCurrencyCode(key);
|
|
669
|
+
const account = (code in this.balance) ? this.balance[code] : this.account();
|
|
670
|
+
account['total'] = this.safeString(value, 'holding');
|
|
671
|
+
account['used'] = this.safeString(value, 'frozen');
|
|
672
|
+
this.balance[code] = account;
|
|
673
|
+
}
|
|
674
|
+
this.balance = this.safeBalance(this.balance);
|
|
675
|
+
client.resolve(this.balance, 'balance');
|
|
676
|
+
}
|
|
610
677
|
handleMessage(client, message) {
|
|
611
678
|
const methods = {
|
|
612
679
|
'ping': this.handlePing,
|
|
@@ -619,6 +686,7 @@ export default class woo extends wooRest {
|
|
|
619
686
|
'auth': this.handleAuth,
|
|
620
687
|
'executionreport': this.handleOrderUpdate,
|
|
621
688
|
'trade': this.handleTrade,
|
|
689
|
+
'balance': this.handleBalance,
|
|
622
690
|
};
|
|
623
691
|
const event = this.safeString(message, 'event');
|
|
624
692
|
let method = this.safeValue(methods, event);
|
package/package.json
CHANGED