ccxt 4.0.107 → 4.0.109
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 +472 -275
- 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/bitfinex2.js +3 -3
- package/dist/cjs/src/bitflyer.js +17 -0
- package/dist/cjs/src/bitforex.js +9 -0
- package/dist/cjs/src/bitget.js +40 -3
- package/dist/cjs/src/bitmart.js +78 -12
- 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/bitfinex2.js +3 -3
- package/js/src/bitflyer.js +17 -0
- package/js/src/bitforex.js +9 -0
- package/js/src/bitget.js +40 -3
- package/js/src/bitmart.js +78 -12
- 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/dist/cjs/src/bitmart.js
CHANGED
|
@@ -1948,7 +1948,7 @@ class bitmart extends bitmart$1 {
|
|
|
1948
1948
|
// "updateTime" : 1681701559408
|
|
1949
1949
|
// }
|
|
1950
1950
|
//
|
|
1951
|
-
// swap: fetchOpenOrders
|
|
1951
|
+
// swap: fetchOrder, fetchOpenOrders
|
|
1952
1952
|
//
|
|
1953
1953
|
// {
|
|
1954
1954
|
// "order_id": "230935812485489",
|
|
@@ -2491,29 +2491,95 @@ class bitmart extends bitmart$1 {
|
|
|
2491
2491
|
/**
|
|
2492
2492
|
* @method
|
|
2493
2493
|
* @name bitmart#fetchOrder
|
|
2494
|
+
* @description fetches information on an order made by the user
|
|
2494
2495
|
* @see https://developer-pro.bitmart.com/en/spot/#query-order-by-id-v4-signed
|
|
2495
2496
|
* @see https://developer-pro.bitmart.com/en/spot/#query-order-by-clientorderid-v4-signed
|
|
2496
|
-
* @
|
|
2497
|
+
* @see https://developer-pro.bitmart.com/en/futures/#get-order-detail-keyed
|
|
2498
|
+
* @param {string} id the id of the order
|
|
2497
2499
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
2498
2500
|
* @param {object} [params] extra parameters specific to the bitmart api endpoint
|
|
2499
|
-
* @param {string} [params.clientOrderId] fetch the order by client order id instead of order id
|
|
2501
|
+
* @param {string} [params.clientOrderId] *spot* fetch the order by client order id instead of order id
|
|
2500
2502
|
* @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
2501
2503
|
*/
|
|
2502
2504
|
await this.loadMarkets();
|
|
2503
2505
|
const request = {};
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
request['orderId'] = id;
|
|
2507
|
-
}
|
|
2506
|
+
let type = undefined;
|
|
2507
|
+
let market = undefined;
|
|
2508
2508
|
let response = undefined;
|
|
2509
|
-
if (
|
|
2510
|
-
|
|
2509
|
+
if (symbol !== undefined) {
|
|
2510
|
+
market = this.market(symbol);
|
|
2511
2511
|
}
|
|
2512
|
-
|
|
2513
|
-
|
|
2512
|
+
[type, params] = this.handleMarketTypeAndParams('fetchOrder', market, params);
|
|
2513
|
+
if (type === 'spot') {
|
|
2514
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
2515
|
+
if (!clientOrderId) {
|
|
2516
|
+
request['orderId'] = id;
|
|
2517
|
+
}
|
|
2518
|
+
if (clientOrderId !== undefined) {
|
|
2519
|
+
response = await this.privatePostSpotV4QueryClientOrder(this.extend(request, params));
|
|
2520
|
+
}
|
|
2521
|
+
else {
|
|
2522
|
+
response = await this.privatePostSpotV4QueryOrder(this.extend(request, params));
|
|
2523
|
+
}
|
|
2514
2524
|
}
|
|
2525
|
+
else if (type === 'swap') {
|
|
2526
|
+
this.checkRequiredSymbol('fetchOrder', symbol);
|
|
2527
|
+
request['symbol'] = market['id'];
|
|
2528
|
+
request['order_id'] = id;
|
|
2529
|
+
response = await this.privateGetContractPrivateOrder(this.extend(request, params));
|
|
2530
|
+
}
|
|
2531
|
+
//
|
|
2532
|
+
// spot
|
|
2533
|
+
//
|
|
2534
|
+
// {
|
|
2535
|
+
// "code": 1000,
|
|
2536
|
+
// "message": "success",
|
|
2537
|
+
// "data": {
|
|
2538
|
+
// "orderId": "183347420821295423",
|
|
2539
|
+
// "clientOrderId": "183347420821295423",
|
|
2540
|
+
// "symbol": "BTC_USDT",
|
|
2541
|
+
// "side": "buy",
|
|
2542
|
+
// "orderMode": "spot",
|
|
2543
|
+
// "type": "limit",
|
|
2544
|
+
// "state": "new",
|
|
2545
|
+
// "price": "24000.00",
|
|
2546
|
+
// "priceAvg": "0.00",
|
|
2547
|
+
// "size": "0.00022",
|
|
2548
|
+
// "filledSize": "0.00000",
|
|
2549
|
+
// "notional": "5.28000000",
|
|
2550
|
+
// "filledNotional": "0.00000000",
|
|
2551
|
+
// "createTime": 1695783014734,
|
|
2552
|
+
// "updateTime": 1695783014762
|
|
2553
|
+
// },
|
|
2554
|
+
// "trace": "ce3e6422c8b44d5fag855348a68693ed.63.14957831547451715"
|
|
2555
|
+
// }
|
|
2556
|
+
//
|
|
2557
|
+
// swap
|
|
2558
|
+
//
|
|
2559
|
+
// {
|
|
2560
|
+
// "code": 1000,
|
|
2561
|
+
// "message": "Ok",
|
|
2562
|
+
// "data": {
|
|
2563
|
+
// "order_id": "230927283405028",
|
|
2564
|
+
// "client_order_id": "",
|
|
2565
|
+
// "price": "23000",
|
|
2566
|
+
// "size": "1",
|
|
2567
|
+
// "symbol": "BTCUSDT",
|
|
2568
|
+
// "state": 2,
|
|
2569
|
+
// "side": 1,
|
|
2570
|
+
// "type": "limit",
|
|
2571
|
+
// "leverage": "10",
|
|
2572
|
+
// "open_type": "isolated",
|
|
2573
|
+
// "deal_avg_price": "0",
|
|
2574
|
+
// "deal_size": "0",
|
|
2575
|
+
// "create_time": 1695783433600,
|
|
2576
|
+
// "update_time": 1695783433613
|
|
2577
|
+
// },
|
|
2578
|
+
// "trace": "4cad855075664097af6ba5257c47605d.63.14957831547451715"
|
|
2579
|
+
// }
|
|
2580
|
+
//
|
|
2515
2581
|
const data = this.safeValue(response, 'data', {});
|
|
2516
|
-
return this.parseOrder(data,
|
|
2582
|
+
return this.parseOrder(data, market);
|
|
2517
2583
|
}
|
|
2518
2584
|
async fetchDepositAddress(code, params = {}) {
|
|
2519
2585
|
/**
|
package/dist/cjs/src/exmo.js
CHANGED
|
@@ -1748,11 +1748,11 @@ class exmo extends exmo$1 {
|
|
|
1748
1748
|
const marketIds = Object.keys(response);
|
|
1749
1749
|
for (let i = 0; i < marketIds.length; i++) {
|
|
1750
1750
|
const marketId = marketIds[i];
|
|
1751
|
-
const
|
|
1751
|
+
const marketInner = this.safeMarket(marketId);
|
|
1752
1752
|
params = this.extend(params, {
|
|
1753
1753
|
'status': 'open',
|
|
1754
1754
|
});
|
|
1755
|
-
const parsedOrders = this.parseOrders(response[marketId],
|
|
1755
|
+
const parsedOrders = this.parseOrders(response[marketId], marketInner, since, limit, params);
|
|
1756
1756
|
orders = this.arrayConcat(orders, parsedOrders);
|
|
1757
1757
|
}
|
|
1758
1758
|
}
|
|
@@ -1955,8 +1955,8 @@ class exmo extends exmo$1 {
|
|
|
1955
1955
|
}
|
|
1956
1956
|
const isSpot = (marginMode !== 'isolated');
|
|
1957
1957
|
if (symbol !== undefined) {
|
|
1958
|
-
const
|
|
1959
|
-
symbol =
|
|
1958
|
+
const marketInner = this.market(symbol);
|
|
1959
|
+
symbol = marketInner['symbol'];
|
|
1960
1960
|
}
|
|
1961
1961
|
const request = {
|
|
1962
1962
|
'limit': limit,
|
|
@@ -1990,7 +1990,7 @@ class exmo extends exmo$1 {
|
|
|
1990
1990
|
return this.parseOrders(response, market, since, limit, params);
|
|
1991
1991
|
}
|
|
1992
1992
|
else {
|
|
1993
|
-
const
|
|
1993
|
+
const responseSwap = await this.privatePostMarginUserOrderHistory(this.extend(request, params));
|
|
1994
1994
|
//
|
|
1995
1995
|
// {
|
|
1996
1996
|
// "items": [
|
|
@@ -2015,7 +2015,7 @@ class exmo extends exmo$1 {
|
|
|
2015
2015
|
// ]
|
|
2016
2016
|
// }
|
|
2017
2017
|
//
|
|
2018
|
-
const items = this.safeValue(
|
|
2018
|
+
const items = this.safeValue(responseSwap, 'items');
|
|
2019
2019
|
const orders = this.parseOrders(items, market, since, limit, params);
|
|
2020
2020
|
const result = [];
|
|
2021
2021
|
for (let i = 0; i < orders.length; i++) {
|
|
@@ -146,11 +146,11 @@ class bitget extends bitget$1 {
|
|
|
146
146
|
const topics = [];
|
|
147
147
|
for (let i = 0; i < marketIds.length; i++) {
|
|
148
148
|
const marketId = marketIds[i];
|
|
149
|
-
const
|
|
149
|
+
const marketInner = this.market(marketId);
|
|
150
150
|
const args = {
|
|
151
151
|
'instType': instType,
|
|
152
152
|
'channel': 'ticker',
|
|
153
|
-
'instId': this.getWsMarketId(
|
|
153
|
+
'instId': this.getWsMarketId(marketInner),
|
|
154
154
|
};
|
|
155
155
|
topics.push(args);
|
|
156
156
|
}
|
|
@@ -190,12 +190,12 @@ class bitget extends bitget$1 {
|
|
|
190
190
|
// watchTickers part
|
|
191
191
|
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
192
192
|
for (let i = 0; i < messageHashes.length; i++) {
|
|
193
|
-
const
|
|
194
|
-
const parts =
|
|
193
|
+
const messageHashTicker = messageHashes[i];
|
|
194
|
+
const parts = messageHashTicker.split('::');
|
|
195
195
|
const symbolsString = parts[1];
|
|
196
196
|
const symbols = symbolsString.split(',');
|
|
197
197
|
if (this.inArray(symbol, symbols)) {
|
|
198
|
-
client.resolve(ticker,
|
|
198
|
+
client.resolve(ticker, messageHashTicker);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
return message;
|
|
@@ -345,12 +345,12 @@ class bybit extends bybit$1 {
|
|
|
345
345
|
// watchTickers part
|
|
346
346
|
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
347
347
|
for (let i = 0; i < messageHashes.length; i++) {
|
|
348
|
-
const
|
|
349
|
-
const parts =
|
|
348
|
+
const messageHashTicker = messageHashes[i];
|
|
349
|
+
const parts = messageHashTicker.split('::');
|
|
350
350
|
const symbolsString = parts[1];
|
|
351
351
|
const symbols = symbolsString.split(',');
|
|
352
352
|
if (this.inArray(parsed['symbol'], symbols)) {
|
|
353
|
-
client.resolve(parsed,
|
|
353
|
+
client.resolve(parsed, messageHashTicker);
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
}
|
package/dist/cjs/src/pro/woo.js
CHANGED
|
@@ -13,7 +13,7 @@ class woo extends woo$1 {
|
|
|
13
13
|
return this.deepExtend(super.describe(), {
|
|
14
14
|
'has': {
|
|
15
15
|
'ws': true,
|
|
16
|
-
'watchBalance':
|
|
16
|
+
'watchBalance': true,
|
|
17
17
|
'watchMyTrades': false,
|
|
18
18
|
'watchOHLCV': true,
|
|
19
19
|
'watchOrderBook': true,
|
|
@@ -604,6 +604,73 @@ class woo extends woo$1 {
|
|
|
604
604
|
client.resolve(this.orders, messageHashSymbol);
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
|
+
async watchBalance(params = {}) {
|
|
608
|
+
/**
|
|
609
|
+
* @method
|
|
610
|
+
* @see https://docs.woo.org/#balance
|
|
611
|
+
* @name woo#watchBalance
|
|
612
|
+
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
613
|
+
* @param {object} [params] extra parameters specific to the woo api endpoint
|
|
614
|
+
* @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
|
|
615
|
+
*/
|
|
616
|
+
await this.loadMarkets();
|
|
617
|
+
const topic = 'balance';
|
|
618
|
+
const messageHash = topic;
|
|
619
|
+
const request = {
|
|
620
|
+
'event': 'subscribe',
|
|
621
|
+
'topic': topic,
|
|
622
|
+
};
|
|
623
|
+
const message = this.extend(request, params);
|
|
624
|
+
return await this.watchPrivate(messageHash, message);
|
|
625
|
+
}
|
|
626
|
+
handleBalance(client, message) {
|
|
627
|
+
//
|
|
628
|
+
// {
|
|
629
|
+
// "topic": "balance",
|
|
630
|
+
// "ts": 1695716888789,
|
|
631
|
+
// "data": {
|
|
632
|
+
// "balances": {
|
|
633
|
+
// "USDT": {
|
|
634
|
+
// "holding": 266.56059176,
|
|
635
|
+
// "frozen": 0,
|
|
636
|
+
// "interest": 0,
|
|
637
|
+
// "pendingShortQty": 0,
|
|
638
|
+
// "pendingExposure": 0,
|
|
639
|
+
// "pendingLongQty": 0,
|
|
640
|
+
// "pendingLongExposure": 0,
|
|
641
|
+
// "version": 37,
|
|
642
|
+
// "staked": 0,
|
|
643
|
+
// "unbonding": 0,
|
|
644
|
+
// "vault": 0,
|
|
645
|
+
// "averageOpenPrice": 0,
|
|
646
|
+
// "pnl24H": 0,
|
|
647
|
+
// "fee24H": 0,
|
|
648
|
+
// "markPrice": 1,
|
|
649
|
+
// "pnl24HPercentage": 0
|
|
650
|
+
// }
|
|
651
|
+
// }
|
|
652
|
+
//
|
|
653
|
+
// }
|
|
654
|
+
//
|
|
655
|
+
const data = this.safeValue(message, 'data');
|
|
656
|
+
const balances = this.safeValue(data, 'balances');
|
|
657
|
+
const keys = Object.keys(balances);
|
|
658
|
+
const ts = this.safeInteger(message, 'ts');
|
|
659
|
+
this.balance['info'] = data;
|
|
660
|
+
this.balance['timestamp'] = ts;
|
|
661
|
+
this.balance['datetime'] = this.iso8601(ts);
|
|
662
|
+
for (let i = 0; i < keys.length; i++) {
|
|
663
|
+
const key = keys[i];
|
|
664
|
+
const value = balances[key];
|
|
665
|
+
const code = this.safeCurrencyCode(key);
|
|
666
|
+
const account = (code in this.balance) ? this.balance[code] : this.account();
|
|
667
|
+
account['total'] = this.safeString(value, 'holding');
|
|
668
|
+
account['used'] = this.safeString(value, 'frozen');
|
|
669
|
+
this.balance[code] = account;
|
|
670
|
+
}
|
|
671
|
+
this.balance = this.safeBalance(this.balance);
|
|
672
|
+
client.resolve(this.balance, 'balance');
|
|
673
|
+
}
|
|
607
674
|
handleMessage(client, message) {
|
|
608
675
|
const methods = {
|
|
609
676
|
'ping': this.handlePing,
|
|
@@ -616,6 +683,7 @@ class woo extends woo$1 {
|
|
|
616
683
|
'auth': this.handleAuth,
|
|
617
684
|
'executionreport': this.handleOrderUpdate,
|
|
618
685
|
'trade': this.handleTrade,
|
|
686
|
+
'balance': this.handleBalance,
|
|
619
687
|
};
|
|
620
688
|
const event = this.safeString(message, 'event');
|
|
621
689
|
let method = this.safeValue(methods, event);
|
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 { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.0.
|
|
7
|
+
declare const version = "4.0.108";
|
|
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, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.0.
|
|
41
|
+
const version = '4.0.109';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -74,11 +74,7 @@ interface Exchange {
|
|
|
74
74
|
sapiGetFiatOrders(params?: {}): Promise<implicitReturnType>;
|
|
75
75
|
sapiGetFiatPayments(params?: {}): Promise<implicitReturnType>;
|
|
76
76
|
sapiGetFuturesTransfer(params?: {}): Promise<implicitReturnType>;
|
|
77
|
-
|
|
78
|
-
sapiGetFuturesLoanRepayHistory(params?: {}): Promise<implicitReturnType>;
|
|
79
|
-
sapiGetFuturesLoanWallet(params?: {}): Promise<implicitReturnType>;
|
|
80
|
-
sapiGetFuturesLoanAdjustCollateralHistory(params?: {}): Promise<implicitReturnType>;
|
|
81
|
-
sapiGetFuturesLoanLiquidationHistory(params?: {}): Promise<implicitReturnType>;
|
|
77
|
+
sapiGetFuturesHistDataLink(params?: {}): Promise<implicitReturnType>;
|
|
82
78
|
sapiGetRebateTaxQuery(params?: {}): Promise<implicitReturnType>;
|
|
83
79
|
sapiGetCapitalConfigGetall(params?: {}): Promise<implicitReturnType>;
|
|
84
80
|
sapiGetCapitalDepositAddress(params?: {}): Promise<implicitReturnType>;
|
|
@@ -442,6 +438,7 @@ interface Exchange {
|
|
|
442
438
|
fapiPublicGetMarkPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
443
439
|
fapiPublicGetIndexPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
444
440
|
fapiPublicGetFundingRate(params?: {}): Promise<implicitReturnType>;
|
|
441
|
+
fapiPublicGetFundingInfo(params?: {}): Promise<implicitReturnType>;
|
|
445
442
|
fapiPublicGetPremiumIndex(params?: {}): Promise<implicitReturnType>;
|
|
446
443
|
fapiPublicGetTicker24hr(params?: {}): Promise<implicitReturnType>;
|
|
447
444
|
fapiPublicGetTickerPrice(params?: {}): Promise<implicitReturnType>;
|
|
@@ -74,11 +74,7 @@ interface binance {
|
|
|
74
74
|
sapiGetFiatOrders(params?: {}): Promise<implicitReturnType>;
|
|
75
75
|
sapiGetFiatPayments(params?: {}): Promise<implicitReturnType>;
|
|
76
76
|
sapiGetFuturesTransfer(params?: {}): Promise<implicitReturnType>;
|
|
77
|
-
|
|
78
|
-
sapiGetFuturesLoanRepayHistory(params?: {}): Promise<implicitReturnType>;
|
|
79
|
-
sapiGetFuturesLoanWallet(params?: {}): Promise<implicitReturnType>;
|
|
80
|
-
sapiGetFuturesLoanAdjustCollateralHistory(params?: {}): Promise<implicitReturnType>;
|
|
81
|
-
sapiGetFuturesLoanLiquidationHistory(params?: {}): Promise<implicitReturnType>;
|
|
77
|
+
sapiGetFuturesHistDataLink(params?: {}): Promise<implicitReturnType>;
|
|
82
78
|
sapiGetRebateTaxQuery(params?: {}): Promise<implicitReturnType>;
|
|
83
79
|
sapiGetCapitalConfigGetall(params?: {}): Promise<implicitReturnType>;
|
|
84
80
|
sapiGetCapitalDepositAddress(params?: {}): Promise<implicitReturnType>;
|
|
@@ -442,6 +438,7 @@ interface binance {
|
|
|
442
438
|
fapiPublicGetMarkPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
443
439
|
fapiPublicGetIndexPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
444
440
|
fapiPublicGetFundingRate(params?: {}): Promise<implicitReturnType>;
|
|
441
|
+
fapiPublicGetFundingInfo(params?: {}): Promise<implicitReturnType>;
|
|
445
442
|
fapiPublicGetPremiumIndex(params?: {}): Promise<implicitReturnType>;
|
|
446
443
|
fapiPublicGetTicker24hr(params?: {}): Promise<implicitReturnType>;
|
|
447
444
|
fapiPublicGetTickerPrice(params?: {}): Promise<implicitReturnType>;
|
|
@@ -74,11 +74,7 @@ interface binance {
|
|
|
74
74
|
sapiGetFiatOrders(params?: {}): Promise<implicitReturnType>;
|
|
75
75
|
sapiGetFiatPayments(params?: {}): Promise<implicitReturnType>;
|
|
76
76
|
sapiGetFuturesTransfer(params?: {}): Promise<implicitReturnType>;
|
|
77
|
-
|
|
78
|
-
sapiGetFuturesLoanRepayHistory(params?: {}): Promise<implicitReturnType>;
|
|
79
|
-
sapiGetFuturesLoanWallet(params?: {}): Promise<implicitReturnType>;
|
|
80
|
-
sapiGetFuturesLoanAdjustCollateralHistory(params?: {}): Promise<implicitReturnType>;
|
|
81
|
-
sapiGetFuturesLoanLiquidationHistory(params?: {}): Promise<implicitReturnType>;
|
|
77
|
+
sapiGetFuturesHistDataLink(params?: {}): Promise<implicitReturnType>;
|
|
82
78
|
sapiGetRebateTaxQuery(params?: {}): Promise<implicitReturnType>;
|
|
83
79
|
sapiGetCapitalConfigGetall(params?: {}): Promise<implicitReturnType>;
|
|
84
80
|
sapiGetCapitalDepositAddress(params?: {}): Promise<implicitReturnType>;
|
|
@@ -442,6 +438,7 @@ interface binance {
|
|
|
442
438
|
fapiPublicGetMarkPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
443
439
|
fapiPublicGetIndexPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
444
440
|
fapiPublicGetFundingRate(params?: {}): Promise<implicitReturnType>;
|
|
441
|
+
fapiPublicGetFundingInfo(params?: {}): Promise<implicitReturnType>;
|
|
445
442
|
fapiPublicGetPremiumIndex(params?: {}): Promise<implicitReturnType>;
|
|
446
443
|
fapiPublicGetTicker24hr(params?: {}): Promise<implicitReturnType>;
|
|
447
444
|
fapiPublicGetTickerPrice(params?: {}): Promise<implicitReturnType>;
|
|
@@ -74,11 +74,7 @@ interface binance {
|
|
|
74
74
|
sapiGetFiatOrders(params?: {}): Promise<implicitReturnType>;
|
|
75
75
|
sapiGetFiatPayments(params?: {}): Promise<implicitReturnType>;
|
|
76
76
|
sapiGetFuturesTransfer(params?: {}): Promise<implicitReturnType>;
|
|
77
|
-
|
|
78
|
-
sapiGetFuturesLoanRepayHistory(params?: {}): Promise<implicitReturnType>;
|
|
79
|
-
sapiGetFuturesLoanWallet(params?: {}): Promise<implicitReturnType>;
|
|
80
|
-
sapiGetFuturesLoanAdjustCollateralHistory(params?: {}): Promise<implicitReturnType>;
|
|
81
|
-
sapiGetFuturesLoanLiquidationHistory(params?: {}): Promise<implicitReturnType>;
|
|
77
|
+
sapiGetFuturesHistDataLink(params?: {}): Promise<implicitReturnType>;
|
|
82
78
|
sapiGetRebateTaxQuery(params?: {}): Promise<implicitReturnType>;
|
|
83
79
|
sapiGetCapitalConfigGetall(params?: {}): Promise<implicitReturnType>;
|
|
84
80
|
sapiGetCapitalDepositAddress(params?: {}): Promise<implicitReturnType>;
|
|
@@ -442,6 +438,7 @@ interface binance {
|
|
|
442
438
|
fapiPublicGetMarkPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
443
439
|
fapiPublicGetIndexPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
444
440
|
fapiPublicGetFundingRate(params?: {}): Promise<implicitReturnType>;
|
|
441
|
+
fapiPublicGetFundingInfo(params?: {}): Promise<implicitReturnType>;
|
|
445
442
|
fapiPublicGetPremiumIndex(params?: {}): Promise<implicitReturnType>;
|
|
446
443
|
fapiPublicGetTicker24hr(params?: {}): Promise<implicitReturnType>;
|
|
447
444
|
fapiPublicGetTickerPrice(params?: {}): Promise<implicitReturnType>;
|
|
@@ -255,7 +255,7 @@ export default class Exchange {
|
|
|
255
255
|
urlencodeNested: (object: any) => string;
|
|
256
256
|
parseDate: (x: any) => number;
|
|
257
257
|
ymd: (timestamp: any, infix: any, fullYear?: boolean) => string;
|
|
258
|
-
isArray: (
|
|
258
|
+
isArray: (needle: any, haystack: any) => any;
|
|
259
259
|
base64ToString: (string: any) => string;
|
|
260
260
|
crc32: typeof functions.crc32;
|
|
261
261
|
describe(): {
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
// ----------------------------------------------------------------------------
|
|
8
8
|
/* eslint-disable */
|
|
9
9
|
import * as functions from './functions.js';
|
|
10
|
-
const { isNode,
|
|
10
|
+
const { isNode, deepExtend, extend, clone, flatten, unique, indexBy, sortBy, sortBy2, safeFloat2, groupBy, aggregate, uuid, unCamelCase, precisionFromString, Throttler, capitalize, now, decimalToPrecision, safeValue, safeValue2, safeString, safeString2, seconds, milliseconds, binaryToBase16, numberToBE, base16ToBinary, iso8601, omit, isJsonEncodedObject, safeInteger, sum, omitZero, implodeParams, extractParams, json, merge, binaryConcat, hash, ecdsa, arrayConcat, encode, urlencode, hmac, numberToString, parseTimeframe, safeInteger2, safeStringLower, parse8601, yyyymmdd, safeStringUpper, safeTimestamp, binaryConcatArray, uuidv1, numberToLE, ymdhms, stringToBase64, decode, uuid22, safeIntegerProduct2, safeIntegerProduct, safeStringLower2, yymmdd, base58ToBinary, binaryToBase58, safeTimestamp2, rawencode, keysort, inArray, isEmpty, ordered, filterBy, uuid16, safeFloat, base64ToBinary, safeStringUpper2, urlencodeWithArrayRepeat, microseconds, binaryToBase64, strip, toArray, safeFloatN, safeIntegerN, safeIntegerProductN, safeTimestampN, safeValueN, safeStringN, safeStringLowerN, safeStringUpperN, urlencodeNested, parseDate, ymd, base64ToString, crc32, TRUNCATE, ROUND, DECIMAL_PLACES, NO_PADDING, TICK_SIZE, SIGNIFICANT_DIGITS } = functions;
|
|
11
|
+
import { keys as keysFunc, values as valuesFunc, inArray as inArrayFunc, vwap as vwapFunc } from './functions.js';
|
|
11
12
|
// import exceptions from "./errors.js"
|
|
12
13
|
import { // eslint-disable-line object-curly-newline
|
|
13
14
|
ExchangeError, BadSymbol, NullResponse, InvalidAddress, InvalidOrder, NotSupported, BadResponse, AuthenticationError, DDoSProtection, RequestTimeout, NetworkError, ExchangeNotAvailable, ArgumentsRequired, RateLimitExceeded, BadRequest } from "./errors.js";
|
|
@@ -99,8 +100,8 @@ export default class Exchange {
|
|
|
99
100
|
this.streaming = {};
|
|
100
101
|
this.deepExtend = deepExtend;
|
|
101
102
|
this.isNode = isNode;
|
|
102
|
-
this.keys =
|
|
103
|
-
this.values =
|
|
103
|
+
this.keys = keysFunc;
|
|
104
|
+
this.values = valuesFunc;
|
|
104
105
|
this.extend = extend;
|
|
105
106
|
this.clone = clone;
|
|
106
107
|
this.flatten = flatten;
|
|
@@ -136,7 +137,7 @@ export default class Exchange {
|
|
|
136
137
|
this.implodeParams = implodeParams;
|
|
137
138
|
this.extractParams = extractParams;
|
|
138
139
|
this.json = json;
|
|
139
|
-
this.vwap =
|
|
140
|
+
this.vwap = vwapFunc;
|
|
140
141
|
this.merge = merge;
|
|
141
142
|
this.binaryConcat = binaryConcat;
|
|
142
143
|
this.hash = hash;
|
|
@@ -191,7 +192,7 @@ export default class Exchange {
|
|
|
191
192
|
this.urlencodeNested = urlencodeNested;
|
|
192
193
|
this.parseDate = parseDate;
|
|
193
194
|
this.ymd = ymd;
|
|
194
|
-
this.isArray =
|
|
195
|
+
this.isArray = inArrayFunc;
|
|
195
196
|
this.base64ToString = base64ToString;
|
|
196
197
|
this.crc32 = crc32;
|
|
197
198
|
Object.assign(this, functions);
|
|
@@ -1837,12 +1838,12 @@ export default class Exchange {
|
|
|
1837
1838
|
entry['amount'] = this.safeNumber(entry, 'amount');
|
|
1838
1839
|
entry['price'] = this.safeNumber(entry, 'price');
|
|
1839
1840
|
entry['cost'] = this.safeNumber(entry, 'cost');
|
|
1840
|
-
const
|
|
1841
|
-
|
|
1842
|
-
if ('rate' in
|
|
1843
|
-
|
|
1841
|
+
const tradeFee = this.safeValue(entry, 'fee', {});
|
|
1842
|
+
tradeFee['cost'] = this.safeNumber(tradeFee, 'cost');
|
|
1843
|
+
if ('rate' in tradeFee) {
|
|
1844
|
+
tradeFee['rate'] = this.safeNumber(tradeFee, 'rate');
|
|
1844
1845
|
}
|
|
1845
|
-
entry['fee'] =
|
|
1846
|
+
entry['fee'] = tradeFee;
|
|
1846
1847
|
}
|
|
1847
1848
|
let timeInForce = this.safeString(order, 'timeInForce');
|
|
1848
1849
|
let postOnly = this.safeValue(order, 'postOnly');
|
|
@@ -2901,9 +2902,9 @@ export default class Exchange {
|
|
|
2901
2902
|
}
|
|
2902
2903
|
const inferredMarketType = (marketType === undefined) ? market['type'] : marketType;
|
|
2903
2904
|
for (let i = 0; i < markets.length; i++) {
|
|
2904
|
-
const
|
|
2905
|
-
if (
|
|
2906
|
-
return
|
|
2905
|
+
const currentMarket = markets[i];
|
|
2906
|
+
if (currentMarket[inferredMarketType]) {
|
|
2907
|
+
return currentMarket;
|
|
2907
2908
|
}
|
|
2908
2909
|
}
|
|
2909
2910
|
}
|
package/js/src/binance.js
CHANGED
|
@@ -271,11 +271,7 @@ export default class binance extends Exchange {
|
|
|
271
271
|
'fiat/orders': 600.03,
|
|
272
272
|
'fiat/payments': 0.1,
|
|
273
273
|
'futures/transfer': 1,
|
|
274
|
-
'futures/
|
|
275
|
-
'futures/loan/repay/history': 1,
|
|
276
|
-
'futures/loan/wallet': 1,
|
|
277
|
-
'futures/loan/adjustCollateral/history': 1,
|
|
278
|
-
'futures/loan/liquidationHistory': 1,
|
|
274
|
+
'futures/histDataLink': 0.1,
|
|
279
275
|
'rebate/taxQuery': 80.004,
|
|
280
276
|
// https://binance-docs.github.io/apidocs/spot/en/#withdraw-sapi
|
|
281
277
|
'capital/config/getall': 1,
|
|
@@ -719,6 +715,7 @@ export default class binance extends Exchange {
|
|
|
719
715
|
'markPriceKlines': { 'cost': 1, 'byLimit': [[99, 1], [499, 2], [1000, 5], [10000, 10]] },
|
|
720
716
|
'indexPriceKlines': { 'cost': 1, 'byLimit': [[99, 1], [499, 2], [1000, 5], [10000, 10]] },
|
|
721
717
|
'fundingRate': 1,
|
|
718
|
+
'fundingInfo': 1,
|
|
722
719
|
'premiumIndex': 1,
|
|
723
720
|
'ticker/24hr': { 'cost': 1, 'noSymbol': 40 },
|
|
724
721
|
'ticker/price': { 'cost': 1, 'noSymbol': 2 },
|
|
@@ -8381,9 +8378,9 @@ export default class binance extends Exchange {
|
|
|
8381
8378
|
const numElements = response.length;
|
|
8382
8379
|
if (numElements > 0) {
|
|
8383
8380
|
const firstElement = response[0];
|
|
8384
|
-
const
|
|
8385
|
-
if (
|
|
8386
|
-
this.throwExactlyMatchedException(this.exceptions['exact'],
|
|
8381
|
+
const errorCode = this.safeString(firstElement, 'code');
|
|
8382
|
+
if (errorCode !== undefined) {
|
|
8383
|
+
this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, this.id + ' ' + body);
|
|
8387
8384
|
}
|
|
8388
8385
|
}
|
|
8389
8386
|
}
|
package/js/src/bitfinex2.js
CHANGED
|
@@ -2607,9 +2607,6 @@ export default class bitfinex2 extends Exchange {
|
|
|
2607
2607
|
else if (type.indexOf('fee') >= 0 || type.indexOf('charged') >= 0) {
|
|
2608
2608
|
return 'fee';
|
|
2609
2609
|
}
|
|
2610
|
-
else if (type.indexOf('exchange') >= 0 || type.indexOf('position') >= 0) {
|
|
2611
|
-
return 'trade';
|
|
2612
|
-
}
|
|
2613
2610
|
else if (type.indexOf('rebate') >= 0) {
|
|
2614
2611
|
return 'rebate';
|
|
2615
2612
|
}
|
|
@@ -2622,6 +2619,9 @@ export default class bitfinex2 extends Exchange {
|
|
|
2622
2619
|
else if (type.indexOf('payment') >= 0) {
|
|
2623
2620
|
return 'payout';
|
|
2624
2621
|
}
|
|
2622
|
+
else if (type.indexOf('exchange') >= 0 || type.indexOf('position') >= 0) {
|
|
2623
|
+
return 'trade';
|
|
2624
|
+
}
|
|
2625
2625
|
else {
|
|
2626
2626
|
return type;
|
|
2627
2627
|
}
|