ccxt 4.4.9 → 4.4.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 +131 -131
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +2 -1
- package/dist/cjs/src/binance.js +6 -9
- package/dist/cjs/src/bingx.js +19 -20
- package/dist/cjs/src/bitfinex2.js +5 -16
- package/dist/cjs/src/bitget.js +6 -5
- package/dist/cjs/src/bitmart.js +1 -0
- package/dist/cjs/src/bitmex.js +4 -3
- package/dist/cjs/src/blofin.js +4 -13
- package/dist/cjs/src/bybit.js +16 -14
- package/dist/cjs/src/coinex.js +15 -1
- package/dist/cjs/src/delta.js +2 -1
- package/dist/cjs/src/deribit.js +1 -0
- package/dist/cjs/src/digifinex.js +15 -1
- package/dist/cjs/src/gate.js +30 -9
- package/dist/cjs/src/hashkey.js +2 -2
- package/dist/cjs/src/hitbtc.js +2 -1
- package/dist/cjs/src/htx.js +26 -3
- package/dist/cjs/src/hyperliquid.js +6 -1
- package/dist/cjs/src/kraken.js +41 -13
- package/dist/cjs/src/krakenfutures.js +3 -2
- package/dist/cjs/src/kucoinfutures.js +11 -0
- package/dist/cjs/src/mexc.js +12 -4
- package/dist/cjs/src/oceanex.js +83 -3
- package/dist/cjs/src/okx.js +15 -0
- package/dist/cjs/src/oxfun.js +4 -4
- package/dist/cjs/src/phemex.js +1 -0
- package/dist/cjs/src/poloniexfutures.js +11 -0
- package/dist/cjs/src/pro/deribit.js +122 -1
- package/dist/cjs/src/pro/exmo.js +31 -1
- package/dist/cjs/src/pro/gate.js +1 -1
- package/dist/cjs/src/pro/okx.js +1 -1
- package/dist/cjs/src/vertex.js +2 -1
- package/dist/cjs/src/whitebit.js +10 -9
- package/dist/cjs/src/woo.js +42 -17
- package/dist/cjs/src/woofipro.js +15 -2
- package/dist/cjs/src/xt.js +2 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/abstract/oceanex.d.ts +5 -0
- package/js/src/ascendex.d.ts +3 -21
- package/js/src/ascendex.js +2 -1
- package/js/src/base/Exchange.d.ts +3 -3
- package/js/src/base/types.d.ts +1 -0
- package/js/src/binance.d.ts +4 -40
- package/js/src/binance.js +6 -9
- package/js/src/bingx.d.ts +4 -40
- package/js/src/bingx.js +19 -20
- package/js/src/bitfinex2.d.ts +3 -22
- package/js/src/bitfinex2.js +5 -16
- package/js/src/bitget.d.ts +3 -39
- package/js/src/bitget.js +6 -5
- package/js/src/bitmart.d.ts +3 -39
- package/js/src/bitmart.js +1 -0
- package/js/src/bitmex.d.ts +3 -21
- package/js/src/bitmex.js +4 -3
- package/js/src/blofin.d.ts +3 -39
- package/js/src/blofin.js +4 -13
- package/js/src/bybit.d.ts +3 -21
- package/js/src/bybit.js +16 -14
- package/js/src/coinex.d.ts +5 -40
- package/js/src/coinex.js +15 -1
- package/js/src/delta.d.ts +4 -40
- package/js/src/delta.js +2 -1
- package/js/src/deribit.d.ts +3 -39
- package/js/src/deribit.js +1 -0
- package/js/src/digifinex.d.ts +4 -21
- package/js/src/digifinex.js +15 -1
- package/js/src/gate.d.ts +6 -41
- package/js/src/gate.js +30 -9
- package/js/src/hashkey.d.ts +4 -40
- package/js/src/hashkey.js +2 -2
- package/js/src/hitbtc.d.ts +4 -40
- package/js/src/hitbtc.js +2 -1
- package/js/src/htx.d.ts +5 -40
- package/js/src/htx.js +26 -3
- package/js/src/hyperliquid.js +6 -1
- package/js/src/kraken.js +41 -13
- package/js/src/krakenfutures.d.ts +3 -21
- package/js/src/krakenfutures.js +3 -2
- package/js/src/kucoinfutures.d.ts +3 -20
- package/js/src/kucoinfutures.js +11 -0
- package/js/src/mexc.d.ts +3 -39
- package/js/src/mexc.js +12 -4
- package/js/src/oceanex.d.ts +9 -1
- package/js/src/oceanex.js +83 -3
- package/js/src/okx.d.ts +4 -39
- package/js/src/okx.js +16 -1
- package/js/src/oxfun.d.ts +3 -21
- package/js/src/oxfun.js +4 -4
- package/js/src/phemex.d.ts +3 -39
- package/js/src/phemex.js +1 -0
- package/js/src/poloniexfutures.d.ts +3 -20
- package/js/src/poloniexfutures.js +11 -0
- package/js/src/pro/deribit.d.ts +5 -1
- package/js/src/pro/deribit.js +122 -1
- package/js/src/pro/exmo.d.ts +2 -1
- package/js/src/pro/exmo.js +31 -1
- package/js/src/pro/gate.js +1 -1
- package/js/src/pro/okx.js +1 -1
- package/js/src/vertex.d.ts +4 -40
- package/js/src/vertex.js +2 -1
- package/js/src/whitebit.d.ts +4 -21
- package/js/src/whitebit.js +10 -9
- package/js/src/woo.d.ts +4 -40
- package/js/src/woo.js +42 -17
- package/js/src/woofipro.d.ts +5 -40
- package/js/src/woofipro.js +15 -2
- package/js/src/xt.d.ts +3 -39
- package/js/src/xt.js +2 -0
- package/package.json +1 -1
package/js/src/blofin.js
CHANGED
|
@@ -796,17 +796,10 @@ export default class blofin extends Exchange {
|
|
|
796
796
|
// "fundingRate": "0.00027815",
|
|
797
797
|
// "fundingTime": "1634256000000",
|
|
798
798
|
// "instId": "BTC-USD-SWAP",
|
|
799
|
-
// "instType": "SWAP",
|
|
800
|
-
// "nextFundingRate": "0.00017",
|
|
801
|
-
// "nextFundingTime": "1634284800000"
|
|
802
799
|
// }
|
|
803
800
|
//
|
|
804
|
-
// in the response above nextFundingRate is actually two funding rates from now
|
|
805
|
-
//
|
|
806
|
-
const nextFundingRateTimestamp = this.safeInteger(contract, 'nextFundingTime');
|
|
807
801
|
const marketId = this.safeString(contract, 'instId');
|
|
808
802
|
const symbol = this.safeSymbol(marketId, market);
|
|
809
|
-
const nextFundingRate = this.safeNumber(contract, 'nextFundingRate');
|
|
810
803
|
const fundingTime = this.safeInteger(contract, 'fundingTime');
|
|
811
804
|
// > The current interest is 0.
|
|
812
805
|
return {
|
|
@@ -821,12 +814,13 @@ export default class blofin extends Exchange {
|
|
|
821
814
|
'fundingRate': this.safeNumber(contract, 'fundingRate'),
|
|
822
815
|
'fundingTimestamp': fundingTime,
|
|
823
816
|
'fundingDatetime': this.iso8601(fundingTime),
|
|
824
|
-
'nextFundingRate':
|
|
825
|
-
'nextFundingTimestamp':
|
|
826
|
-
'nextFundingDatetime':
|
|
817
|
+
'nextFundingRate': undefined,
|
|
818
|
+
'nextFundingTimestamp': undefined,
|
|
819
|
+
'nextFundingDatetime': undefined,
|
|
827
820
|
'previousFundingRate': undefined,
|
|
828
821
|
'previousFundingTimestamp': undefined,
|
|
829
822
|
'previousFundingDatetime': undefined,
|
|
823
|
+
'interval': undefined,
|
|
830
824
|
};
|
|
831
825
|
}
|
|
832
826
|
async fetchFundingRate(symbol, params = {}) {
|
|
@@ -856,9 +850,6 @@ export default class blofin extends Exchange {
|
|
|
856
850
|
// "fundingRate": "0.00027815",
|
|
857
851
|
// "fundingTime": "1634256000000",
|
|
858
852
|
// "instId": "BTC-USD-SWAP",
|
|
859
|
-
// "instType": "SWAP",
|
|
860
|
-
// "nextFundingRate": "0.00017",
|
|
861
|
-
// "nextFundingTime": "1634284800000"
|
|
862
853
|
// }
|
|
863
854
|
// ],
|
|
864
855
|
// "msg": ""
|
package/js/src/bybit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/bybit.js';
|
|
2
|
-
import type { Int, OrderSide, OrderType, Trade, Order, OHLCV, FundingRateHistory, OpenInterest, OrderRequest, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Liquidation, Leverage, Num, FundingHistory, Option, OptionChain, TradingFeeInterface, Currencies, TradingFees, CancellationRequest, Position, CrossBorrowRate, Dict, LeverageTier, LeverageTiers, int, LedgerEntry, Conversion } from './base/types.js';
|
|
2
|
+
import type { Int, OrderSide, OrderType, Trade, Order, OHLCV, FundingRateHistory, OpenInterest, OrderRequest, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Liquidation, Leverage, Num, FundingHistory, Option, OptionChain, TradingFeeInterface, Currencies, TradingFees, CancellationRequest, Position, CrossBorrowRate, Dict, LeverageTier, LeverageTiers, int, LedgerEntry, Conversion, FundingRate, FundingRates } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class bybit
|
|
5
5
|
* @augments Exchange
|
|
@@ -29,26 +29,8 @@ export default class bybit extends Exchange {
|
|
|
29
29
|
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
30
30
|
parseOHLCV(ohlcv: any, market?: Market): OHLCV;
|
|
31
31
|
fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
32
|
-
parseFundingRate(ticker: any, market?: Market):
|
|
33
|
-
|
|
34
|
-
symbol: string;
|
|
35
|
-
markPrice: number;
|
|
36
|
-
indexPrice: number;
|
|
37
|
-
interestRate: any;
|
|
38
|
-
estimatedSettlePrice: any;
|
|
39
|
-
timestamp: number;
|
|
40
|
-
datetime: string;
|
|
41
|
-
fundingRate: number;
|
|
42
|
-
fundingTimestamp: number;
|
|
43
|
-
fundingDatetime: string;
|
|
44
|
-
nextFundingRate: any;
|
|
45
|
-
nextFundingTimestamp: any;
|
|
46
|
-
nextFundingDatetime: any;
|
|
47
|
-
previousFundingRate: any;
|
|
48
|
-
previousFundingTimestamp: any;
|
|
49
|
-
previousFundingDatetime: any;
|
|
50
|
-
};
|
|
51
|
-
fetchFundingRates(symbols?: Strings, params?: {}): Promise<any>;
|
|
32
|
+
parseFundingRate(ticker: any, market?: Market): FundingRate;
|
|
33
|
+
fetchFundingRates(symbols?: Strings, params?: {}): Promise<FundingRates>;
|
|
52
34
|
fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
|
|
53
35
|
parseTrade(trade: Dict, market?: Market): Trade;
|
|
54
36
|
fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
package/js/src/bybit.js
CHANGED
|
@@ -82,7 +82,7 @@ export default class bybit extends Exchange {
|
|
|
82
82
|
'fetchDepositWithdrawFee': 'emulated',
|
|
83
83
|
'fetchDepositWithdrawFees': true,
|
|
84
84
|
'fetchFundingHistory': true,
|
|
85
|
-
'fetchFundingRate':
|
|
85
|
+
'fetchFundingRate': 'emulated',
|
|
86
86
|
'fetchFundingRateHistory': true,
|
|
87
87
|
'fetchFundingRates': true,
|
|
88
88
|
'fetchGreeks': true,
|
|
@@ -2438,6 +2438,7 @@ export default class bybit extends Exchange {
|
|
|
2438
2438
|
return this.parseOHLCVs(ohlcvs, market, timeframe, since, limit);
|
|
2439
2439
|
}
|
|
2440
2440
|
parseFundingRate(ticker, market = undefined) {
|
|
2441
|
+
//
|
|
2441
2442
|
// {
|
|
2442
2443
|
// "symbol": "BTCUSDT",
|
|
2443
2444
|
// "bidPrice": "19255",
|
|
@@ -2488,6 +2489,7 @@ export default class bybit extends Exchange {
|
|
|
2488
2489
|
'previousFundingRate': undefined,
|
|
2489
2490
|
'previousFundingTimestamp': undefined,
|
|
2490
2491
|
'previousFundingDatetime': undefined,
|
|
2492
|
+
'interval': undefined,
|
|
2491
2493
|
};
|
|
2492
2494
|
}
|
|
2493
2495
|
async fetchFundingRates(symbols = undefined, params = {}) {
|
|
@@ -2498,7 +2500,7 @@ export default class bybit extends Exchange {
|
|
|
2498
2500
|
* @see https://bybit-exchange.github.io/docs/v5/market/tickers
|
|
2499
2501
|
* @param {string[]} symbols unified symbols of the markets to fetch the funding rates for, all market funding rates are returned if not assigned
|
|
2500
2502
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2501
|
-
* @returns {object}
|
|
2503
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
2502
2504
|
*/
|
|
2503
2505
|
await this.loadMarkets();
|
|
2504
2506
|
let market = undefined;
|
|
@@ -2558,18 +2560,10 @@ export default class bybit extends Exchange {
|
|
|
2558
2560
|
// "time": 1663670053454
|
|
2559
2561
|
// }
|
|
2560
2562
|
//
|
|
2561
|
-
|
|
2562
|
-
const
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
for (let i = 0; i < tickerList.length; i++) {
|
|
2566
|
-
const rawTicker = tickerList[i];
|
|
2567
|
-
rawTicker['timestamp'] = timestamp; // will be removed inside the parser
|
|
2568
|
-
const ticker = this.parseFundingRate(tickerList[i], undefined);
|
|
2569
|
-
const symbol = ticker['symbol'];
|
|
2570
|
-
fundingRates[symbol] = ticker;
|
|
2571
|
-
}
|
|
2572
|
-
return this.filterByArray(fundingRates, 'symbol', symbols);
|
|
2563
|
+
const data = this.safeDict(response, 'result', {});
|
|
2564
|
+
const tickerList = this.safeList(data, 'list', []);
|
|
2565
|
+
const result = this.parseFundingRates(tickerList);
|
|
2566
|
+
return this.filterByArray(result, 'symbol', symbols);
|
|
2573
2567
|
}
|
|
2574
2568
|
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2575
2569
|
/**
|
|
@@ -3713,6 +3707,7 @@ export default class bybit extends Exchange {
|
|
|
3713
3707
|
// 'orderIv': '0', // Implied volatility; parameters are passed according to the real value; for example, for 10%, 0.1 is passed
|
|
3714
3708
|
};
|
|
3715
3709
|
const hedged = this.safeBool(params, 'hedged', false);
|
|
3710
|
+
const reduceOnly = this.safeBool(params, 'reduceOnly');
|
|
3716
3711
|
let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
|
|
3717
3712
|
const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
|
|
3718
3713
|
const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
|
|
@@ -3912,6 +3907,10 @@ export default class bybit extends Exchange {
|
|
|
3912
3907
|
}
|
|
3913
3908
|
}
|
|
3914
3909
|
if (!market['spot'] && hedged) {
|
|
3910
|
+
if (reduceOnly) {
|
|
3911
|
+
params = this.omit(params, 'reduceOnly');
|
|
3912
|
+
side = (side === 'buy') ? 'sell' : 'buy';
|
|
3913
|
+
}
|
|
3915
3914
|
request['positionIdx'] = (side === 'buy') ? 1 : 2;
|
|
3916
3915
|
}
|
|
3917
3916
|
params = this.omit(params, ['stopPrice', 'timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'clientOrderId', 'triggerPrice', 'stopLoss', 'takeProfit', 'trailingAmount', 'trailingTriggerPrice', 'hedged']);
|
|
@@ -6831,6 +6830,8 @@ export default class bybit extends Exchange {
|
|
|
6831
6830
|
}
|
|
6832
6831
|
const maintenanceMarginPercentage = Precise.stringDiv(maintenanceMarginString, notional);
|
|
6833
6832
|
const marginRatio = Precise.stringDiv(maintenanceMarginString, collateralString, 4);
|
|
6833
|
+
const positionIdx = this.safeString(position, 'positionIdx');
|
|
6834
|
+
const hedged = (positionIdx !== undefined) && (positionIdx !== '0');
|
|
6834
6835
|
return this.safePosition({
|
|
6835
6836
|
'info': position,
|
|
6836
6837
|
'id': undefined,
|
|
@@ -6859,6 +6860,7 @@ export default class bybit extends Exchange {
|
|
|
6859
6860
|
'percentage': undefined,
|
|
6860
6861
|
'stopLossPrice': this.safeNumber2(position, 'stop_loss', 'stopLoss'),
|
|
6861
6862
|
'takeProfitPrice': this.safeNumber2(position, 'take_profit', 'takeProfit'),
|
|
6863
|
+
'hedged': hedged,
|
|
6862
6864
|
});
|
|
6863
6865
|
}
|
|
6864
6866
|
async fetchLeverage(symbol, params = {}) {
|
package/js/src/coinex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/coinex.js';
|
|
2
|
-
import type { Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, OHLCV, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, OrderRequest, TransferEntry, Leverage, Num, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position, IsolatedBorrowRate, Dict, LeverageTiers, LeverageTier, int } from './base/types.js';
|
|
2
|
+
import type { Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, OHLCV, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, OrderRequest, TransferEntry, Leverage, Num, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position, IsolatedBorrowRate, Dict, LeverageTiers, LeverageTier, int, FundingRate, FundingRates } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class coinex
|
|
5
5
|
* @augments Exchange
|
|
@@ -75,45 +75,10 @@ export default class coinex extends Exchange {
|
|
|
75
75
|
addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
76
76
|
reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
77
77
|
fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
78
|
-
fetchFundingRate(symbol: string, params?: {}): Promise<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
indexPrice: any;
|
|
83
|
-
interestRate: any;
|
|
84
|
-
estimatedSettlePrice: any;
|
|
85
|
-
timestamp: any;
|
|
86
|
-
datetime: any;
|
|
87
|
-
fundingRate: number;
|
|
88
|
-
fundingTimestamp: number;
|
|
89
|
-
fundingDatetime: string;
|
|
90
|
-
nextFundingRate: number;
|
|
91
|
-
nextFundingTimestamp: number;
|
|
92
|
-
nextFundingDatetime: string;
|
|
93
|
-
previousFundingRate: any;
|
|
94
|
-
previousFundingTimestamp: any;
|
|
95
|
-
previousFundingDatetime: any;
|
|
96
|
-
}>;
|
|
97
|
-
parseFundingRate(contract: any, market?: Market): {
|
|
98
|
-
info: any;
|
|
99
|
-
symbol: string;
|
|
100
|
-
markPrice: number;
|
|
101
|
-
indexPrice: any;
|
|
102
|
-
interestRate: any;
|
|
103
|
-
estimatedSettlePrice: any;
|
|
104
|
-
timestamp: any;
|
|
105
|
-
datetime: any;
|
|
106
|
-
fundingRate: number;
|
|
107
|
-
fundingTimestamp: number;
|
|
108
|
-
fundingDatetime: string;
|
|
109
|
-
nextFundingRate: number;
|
|
110
|
-
nextFundingTimestamp: number;
|
|
111
|
-
nextFundingDatetime: string;
|
|
112
|
-
previousFundingRate: any;
|
|
113
|
-
previousFundingTimestamp: any;
|
|
114
|
-
previousFundingDatetime: any;
|
|
115
|
-
};
|
|
116
|
-
fetchFundingRates(symbols?: Strings, params?: {}): Promise<any>;
|
|
78
|
+
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
79
|
+
parseFundingRate(contract: any, market?: Market): FundingRate;
|
|
80
|
+
parseFundingInterval(interval: any): string;
|
|
81
|
+
fetchFundingRates(symbols?: Strings, params?: {}): Promise<FundingRates>;
|
|
117
82
|
withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
|
|
118
83
|
parseTransactionStatus(status: Str): string;
|
|
119
84
|
fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
|
package/js/src/coinex.js
CHANGED
|
@@ -4573,6 +4573,9 @@ export default class coinex extends Exchange {
|
|
|
4573
4573
|
//
|
|
4574
4574
|
const currentFundingTimestamp = this.safeInteger(contract, 'latest_funding_time');
|
|
4575
4575
|
const futureFundingTimestamp = this.safeInteger(contract, 'next_funding_time');
|
|
4576
|
+
const fundingTimeString = this.safeString(contract, 'latest_funding_time');
|
|
4577
|
+
const nextFundingTimeString = this.safeString(contract, 'next_funding_time');
|
|
4578
|
+
const millisecondsInterval = Precise.stringSub(nextFundingTimeString, fundingTimeString);
|
|
4576
4579
|
const marketId = this.safeString(contract, 'market');
|
|
4577
4580
|
return {
|
|
4578
4581
|
'info': contract,
|
|
@@ -4592,13 +4595,24 @@ export default class coinex extends Exchange {
|
|
|
4592
4595
|
'previousFundingRate': undefined,
|
|
4593
4596
|
'previousFundingTimestamp': undefined,
|
|
4594
4597
|
'previousFundingDatetime': undefined,
|
|
4598
|
+
'interval': this.parseFundingInterval(millisecondsInterval),
|
|
4595
4599
|
};
|
|
4596
4600
|
}
|
|
4601
|
+
parseFundingInterval(interval) {
|
|
4602
|
+
const intervals = {
|
|
4603
|
+
'3600000': '1h',
|
|
4604
|
+
'14400000': '4h',
|
|
4605
|
+
'28800000': '8h',
|
|
4606
|
+
'57600000': '16h',
|
|
4607
|
+
'86400000': '24h',
|
|
4608
|
+
};
|
|
4609
|
+
return this.safeString(intervals, interval, interval);
|
|
4610
|
+
}
|
|
4597
4611
|
async fetchFundingRates(symbols = undefined, params = {}) {
|
|
4598
4612
|
/**
|
|
4599
4613
|
* @method
|
|
4600
4614
|
* @name coinex#fetchFundingRates
|
|
4601
|
-
* @description fetch the current funding rates
|
|
4615
|
+
* @description fetch the current funding rates for multiple markets
|
|
4602
4616
|
* @see https://docs.coinex.com/api/v2/futures/market/http/list-market-funding-rate
|
|
4603
4617
|
* @param {string[]} symbols unified market symbols
|
|
4604
4618
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
package/js/src/delta.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/delta.js';
|
|
2
|
-
import type { Balances, Currency, Greeks, Int, Market, MarketInterface, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Position, Leverage, MarginMode, Num, Option, MarginModification, Currencies, Dict, int, LedgerEntry } from './base/types.js';
|
|
2
|
+
import type { Balances, Currency, Greeks, Int, Market, MarketInterface, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Position, Leverage, MarginMode, Num, Option, MarginModification, Currencies, Dict, int, LedgerEntry, FundingRate, FundingRates } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class delta
|
|
5
5
|
* @augments Exchange
|
|
@@ -60,45 +60,9 @@ export default class delta extends Exchange {
|
|
|
60
60
|
network: string;
|
|
61
61
|
info: any;
|
|
62
62
|
};
|
|
63
|
-
fetchFundingRate(symbol: string, params?: {}): Promise<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
markPrice: number;
|
|
67
|
-
indexPrice: number;
|
|
68
|
-
interestRate: any;
|
|
69
|
-
estimatedSettlePrice: any;
|
|
70
|
-
timestamp: number;
|
|
71
|
-
datetime: string;
|
|
72
|
-
fundingRate: number;
|
|
73
|
-
fundingTimestamp: any;
|
|
74
|
-
fundingDatetime: any;
|
|
75
|
-
nextFundingRate: any;
|
|
76
|
-
nextFundingTimestamp: any;
|
|
77
|
-
nextFundingDatetime: any;
|
|
78
|
-
previousFundingRate: any;
|
|
79
|
-
previousFundingTimestamp: any;
|
|
80
|
-
previousFundingDatetime: any;
|
|
81
|
-
}>;
|
|
82
|
-
fetchFundingRates(symbols?: Strings, params?: {}): Promise<any>;
|
|
83
|
-
parseFundingRate(contract: any, market?: Market): {
|
|
84
|
-
info: any;
|
|
85
|
-
symbol: string;
|
|
86
|
-
markPrice: number;
|
|
87
|
-
indexPrice: number;
|
|
88
|
-
interestRate: any;
|
|
89
|
-
estimatedSettlePrice: any;
|
|
90
|
-
timestamp: number;
|
|
91
|
-
datetime: string;
|
|
92
|
-
fundingRate: number;
|
|
93
|
-
fundingTimestamp: any;
|
|
94
|
-
fundingDatetime: any;
|
|
95
|
-
nextFundingRate: any;
|
|
96
|
-
nextFundingTimestamp: any;
|
|
97
|
-
nextFundingDatetime: any;
|
|
98
|
-
previousFundingRate: any;
|
|
99
|
-
previousFundingTimestamp: any;
|
|
100
|
-
previousFundingDatetime: any;
|
|
101
|
-
};
|
|
63
|
+
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
64
|
+
fetchFundingRates(symbols?: Strings, params?: {}): Promise<FundingRates>;
|
|
65
|
+
parseFundingRate(contract: any, market?: Market): FundingRate;
|
|
102
66
|
addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
103
67
|
reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
104
68
|
modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<MarginModification>;
|
package/js/src/delta.js
CHANGED
|
@@ -2455,7 +2455,7 @@ export default class delta extends Exchange {
|
|
|
2455
2455
|
* @see https://docs.delta.exchange/#get-tickers-for-products
|
|
2456
2456
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
2457
2457
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2458
|
-
* @returns {object} a
|
|
2458
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
|
|
2459
2459
|
*/
|
|
2460
2460
|
await this.loadMarkets();
|
|
2461
2461
|
symbols = this.marketSymbols(symbols);
|
|
@@ -2579,6 +2579,7 @@ export default class delta extends Exchange {
|
|
|
2579
2579
|
'previousFundingRate': undefined,
|
|
2580
2580
|
'previousFundingTimestamp': undefined,
|
|
2581
2581
|
'previousFundingDatetime': undefined,
|
|
2582
|
+
'interval': undefined,
|
|
2582
2583
|
};
|
|
2583
2584
|
}
|
|
2584
2585
|
async addMargin(symbol, amount, params = {}) {
|
package/js/src/deribit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/deribit.js';
|
|
2
|
-
import type { Balances, Currency, FundingRateHistory, Greeks, Int, Liquidation, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry, MarketInterface, Num, Account, Option, OptionChain, Currencies, TradingFees, Dict, int } from './base/types.js';
|
|
2
|
+
import type { Balances, Currency, FundingRateHistory, Greeks, Int, Liquidation, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry, MarketInterface, Num, Account, Option, OptionChain, Currencies, TradingFees, Dict, int, FundingRate } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class deribit
|
|
5
5
|
* @augments Exchange
|
|
@@ -89,45 +89,9 @@ export default class deribit extends Exchange {
|
|
|
89
89
|
networks: {};
|
|
90
90
|
};
|
|
91
91
|
fetchDepositWithdrawFees(codes?: Strings, params?: {}): Promise<any>;
|
|
92
|
-
fetchFundingRate(symbol: string, params?: {}): Promise<
|
|
93
|
-
info: any;
|
|
94
|
-
symbol: string;
|
|
95
|
-
markPrice: any;
|
|
96
|
-
indexPrice: number;
|
|
97
|
-
interestRate: any;
|
|
98
|
-
estimatedSettlePrice: any;
|
|
99
|
-
timestamp: number;
|
|
100
|
-
datetime: string;
|
|
101
|
-
fundingRate: number;
|
|
102
|
-
fundingTimestamp: any;
|
|
103
|
-
fundingDatetime: any;
|
|
104
|
-
nextFundingRate: any;
|
|
105
|
-
nextFundingTimestamp: any;
|
|
106
|
-
nextFundingDatetime: any;
|
|
107
|
-
previousFundingRate: any;
|
|
108
|
-
previousFundingTimestamp: any;
|
|
109
|
-
previousFundingDatetime: any;
|
|
110
|
-
}>;
|
|
92
|
+
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
111
93
|
fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
|
|
112
|
-
parseFundingRate(contract: any, market?: Market):
|
|
113
|
-
info: any;
|
|
114
|
-
symbol: string;
|
|
115
|
-
markPrice: any;
|
|
116
|
-
indexPrice: number;
|
|
117
|
-
interestRate: any;
|
|
118
|
-
estimatedSettlePrice: any;
|
|
119
|
-
timestamp: number;
|
|
120
|
-
datetime: string;
|
|
121
|
-
fundingRate: number;
|
|
122
|
-
fundingTimestamp: any;
|
|
123
|
-
fundingDatetime: any;
|
|
124
|
-
nextFundingRate: any;
|
|
125
|
-
nextFundingTimestamp: any;
|
|
126
|
-
nextFundingDatetime: any;
|
|
127
|
-
previousFundingRate: any;
|
|
128
|
-
previousFundingTimestamp: any;
|
|
129
|
-
previousFundingDatetime: any;
|
|
130
|
-
};
|
|
94
|
+
parseFundingRate(contract: any, market?: Market): FundingRate;
|
|
131
95
|
fetchLiquidations(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Liquidation[]>;
|
|
132
96
|
addPaginationCursorToResult(cursor: any, data: any): any;
|
|
133
97
|
fetchMyLiquidations(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Liquidation[]>;
|
package/js/src/deribit.js
CHANGED
|
@@ -3140,6 +3140,7 @@ export default class deribit extends Exchange {
|
|
|
3140
3140
|
'previousFundingRate': undefined,
|
|
3141
3141
|
'previousFundingTimestamp': undefined,
|
|
3142
3142
|
'previousFundingDatetime': undefined,
|
|
3143
|
+
'interval': '8h',
|
|
3143
3144
|
};
|
|
3144
3145
|
}
|
|
3145
3146
|
async fetchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
|
package/js/src/digifinex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/digifinex.js';
|
|
2
|
-
import type { FundingRateHistory, Int, OHLCV, Order, OrderSide, OrderType, OrderRequest, Trade, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Strings, Market, Currency, TransferEntry, Num, MarginModification, TradingFeeInterface, Currencies, CrossBorrowRate, CrossBorrowRates, Dict, LeverageTier, LeverageTiers, int, LedgerEntry } from './base/types.js';
|
|
2
|
+
import type { FundingRateHistory, Int, OHLCV, Order, OrderSide, OrderType, OrderRequest, Trade, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Strings, Market, Currency, TransferEntry, Num, MarginModification, TradingFeeInterface, Currencies, CrossBorrowRate, CrossBorrowRates, Dict, LeverageTier, LeverageTiers, int, LedgerEntry, FundingRate } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class digifinex
|
|
5
5
|
* @augments Exchange
|
|
@@ -84,26 +84,9 @@ export default class digifinex extends Exchange {
|
|
|
84
84
|
info: any;
|
|
85
85
|
};
|
|
86
86
|
parseBorrowRates(info: any, codeKey: any): any;
|
|
87
|
-
fetchFundingRate(symbol: string, params?: {}): Promise<
|
|
88
|
-
parseFundingRate(contract: any, market?: Market):
|
|
89
|
-
|
|
90
|
-
symbol: string;
|
|
91
|
-
markPrice: any;
|
|
92
|
-
indexPrice: any;
|
|
93
|
-
interestRate: any;
|
|
94
|
-
estimatedSettlePrice: any;
|
|
95
|
-
timestamp: any;
|
|
96
|
-
datetime: any;
|
|
97
|
-
fundingRate: number;
|
|
98
|
-
fundingTimestamp: number;
|
|
99
|
-
fundingDatetime: string;
|
|
100
|
-
nextFundingRate: string;
|
|
101
|
-
nextFundingTimestamp: number;
|
|
102
|
-
nextFundingDatetime: string;
|
|
103
|
-
previousFundingRate: any;
|
|
104
|
-
previousFundingTimestamp: any;
|
|
105
|
-
previousFundingDatetime: any;
|
|
106
|
-
};
|
|
87
|
+
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
88
|
+
parseFundingRate(contract: any, market?: Market): FundingRate;
|
|
89
|
+
parseFundingInterval(interval: any): string;
|
|
107
90
|
fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
|
|
108
91
|
fetchTradingFee(symbol: string, params?: {}): Promise<TradingFeeInterface>;
|
|
109
92
|
parseTradingFee(fee: Dict, market?: Market): TradingFeeInterface;
|
package/js/src/digifinex.js
CHANGED
|
@@ -3266,6 +3266,9 @@ export default class digifinex extends Exchange {
|
|
|
3266
3266
|
const marketId = this.safeString(contract, 'instrument_id');
|
|
3267
3267
|
const timestamp = this.safeInteger(contract, 'funding_time');
|
|
3268
3268
|
const nextTimestamp = this.safeInteger(contract, 'next_funding_time');
|
|
3269
|
+
const fundingTimeString = this.safeString(contract, 'funding_time');
|
|
3270
|
+
const nextFundingTimeString = this.safeString(contract, 'next_funding_time');
|
|
3271
|
+
const millisecondsInterval = Precise.stringSub(nextFundingTimeString, fundingTimeString);
|
|
3269
3272
|
return {
|
|
3270
3273
|
'info': contract,
|
|
3271
3274
|
'symbol': this.safeSymbol(marketId, market),
|
|
@@ -3278,14 +3281,25 @@ export default class digifinex extends Exchange {
|
|
|
3278
3281
|
'fundingRate': this.safeNumber(contract, 'funding_rate'),
|
|
3279
3282
|
'fundingTimestamp': timestamp,
|
|
3280
3283
|
'fundingDatetime': this.iso8601(timestamp),
|
|
3281
|
-
'nextFundingRate': this.
|
|
3284
|
+
'nextFundingRate': this.safeNumber(contract, 'next_funding_rate'),
|
|
3282
3285
|
'nextFundingTimestamp': nextTimestamp,
|
|
3283
3286
|
'nextFundingDatetime': this.iso8601(nextTimestamp),
|
|
3284
3287
|
'previousFundingRate': undefined,
|
|
3285
3288
|
'previousFundingTimestamp': undefined,
|
|
3286
3289
|
'previousFundingDatetime': undefined,
|
|
3290
|
+
'interval': this.parseFundingInterval(millisecondsInterval),
|
|
3287
3291
|
};
|
|
3288
3292
|
}
|
|
3293
|
+
parseFundingInterval(interval) {
|
|
3294
|
+
const intervals = {
|
|
3295
|
+
'3600000': '1h',
|
|
3296
|
+
'14400000': '4h',
|
|
3297
|
+
'28800000': '8h',
|
|
3298
|
+
'57600000': '16h',
|
|
3299
|
+
'86400000': '24h',
|
|
3300
|
+
};
|
|
3301
|
+
return this.safeString(intervals, interval, interval);
|
|
3302
|
+
}
|
|
3289
3303
|
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3290
3304
|
/**
|
|
3291
3305
|
* @method
|
package/js/src/gate.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/gate.js';
|
|
2
|
-
import type { Int, OrderSide, OrderType, OHLCV, Trade, FundingRateHistory, OpenInterest, Order, Balances, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Leverage, Leverages, Num, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position, Dict, LeverageTier, LeverageTiers, int, CancellationRequest, LedgerEntry } from './base/types.js';
|
|
2
|
+
import type { Int, OrderSide, OrderType, OHLCV, Trade, FundingRateHistory, OpenInterest, Order, Balances, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Leverage, Leverages, Num, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position, Dict, LeverageTier, LeverageTiers, int, CancellationRequest, LedgerEntry, FundingRate, FundingRates } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class gate
|
|
5
5
|
* @augments Exchange
|
|
@@ -71,45 +71,10 @@ export default class gate extends Exchange {
|
|
|
71
71
|
getMarginMode(stop: any, params: any): any[];
|
|
72
72
|
getSettlementCurrencies(type: any, method: any): any;
|
|
73
73
|
fetchCurrencies(params?: {}): Promise<Currencies>;
|
|
74
|
-
fetchFundingRate(symbol: string, params?: {}): Promise<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
indexPrice: number;
|
|
79
|
-
interestRate: number;
|
|
80
|
-
estimatedSettlePrice: any;
|
|
81
|
-
timestamp: any;
|
|
82
|
-
datetime: any;
|
|
83
|
-
fundingRate: number;
|
|
84
|
-
fundingTimestamp: number;
|
|
85
|
-
fundingDatetime: string;
|
|
86
|
-
nextFundingRate: number;
|
|
87
|
-
nextFundingTimestamp: any;
|
|
88
|
-
nextFundingDatetime: any;
|
|
89
|
-
previousFundingRate: any;
|
|
90
|
-
previousFundingTimestamp: any;
|
|
91
|
-
previousFundingDatetime: any;
|
|
92
|
-
}>;
|
|
93
|
-
fetchFundingRates(symbols?: Strings, params?: {}): Promise<any>;
|
|
94
|
-
parseFundingRate(contract: any, market?: Market): {
|
|
95
|
-
info: any;
|
|
96
|
-
symbol: string;
|
|
97
|
-
markPrice: number;
|
|
98
|
-
indexPrice: number;
|
|
99
|
-
interestRate: number;
|
|
100
|
-
estimatedSettlePrice: any;
|
|
101
|
-
timestamp: any;
|
|
102
|
-
datetime: any;
|
|
103
|
-
fundingRate: number;
|
|
104
|
-
fundingTimestamp: number;
|
|
105
|
-
fundingDatetime: string;
|
|
106
|
-
nextFundingRate: number;
|
|
107
|
-
nextFundingTimestamp: any;
|
|
108
|
-
nextFundingDatetime: any;
|
|
109
|
-
previousFundingRate: any;
|
|
110
|
-
previousFundingTimestamp: any;
|
|
111
|
-
previousFundingDatetime: any;
|
|
112
|
-
};
|
|
74
|
+
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
75
|
+
fetchFundingRates(symbols?: Strings, params?: {}): Promise<FundingRates>;
|
|
76
|
+
parseFundingRate(contract: any, market?: Market): FundingRate;
|
|
77
|
+
parseFundingInterval(interval: any): string;
|
|
113
78
|
fetchNetworkDepositAddress(code: string, params?: {}): Promise<Dict>;
|
|
114
79
|
fetchDepositAddress(code: string, params?: {}): Promise<{
|
|
115
80
|
info: any;
|
|
@@ -177,7 +142,7 @@ export default class gate extends Exchange {
|
|
|
177
142
|
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
178
143
|
fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
179
144
|
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
180
|
-
|
|
145
|
+
prepareOrdersByStatusRequest(status: any, symbol?: Str, since?: Int, limit?: Int, params?: {}): object[];
|
|
181
146
|
fetchOrdersByStatus(status: any, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
182
147
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
183
148
|
cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
|
package/js/src/gate.js
CHANGED
|
@@ -1750,7 +1750,7 @@ export default class gate extends Exchange {
|
|
|
1750
1750
|
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
|
|
1751
1751
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
1752
1752
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1753
|
-
* @returns {object} a
|
|
1753
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
|
|
1754
1754
|
*/
|
|
1755
1755
|
await this.loadMarkets();
|
|
1756
1756
|
symbols = this.marketSymbols(symbols);
|
|
@@ -1854,6 +1854,7 @@ export default class gate extends Exchange {
|
|
|
1854
1854
|
const fundingRate = this.safeNumber(contract, 'funding_rate');
|
|
1855
1855
|
const fundingTime = this.safeTimestamp(contract, 'funding_next_apply');
|
|
1856
1856
|
const fundingRateIndicative = this.safeNumber(contract, 'funding_rate_indicative');
|
|
1857
|
+
const fundingInterval = Precise.stringMul('1000', this.safeString(contract, 'funding_interval'));
|
|
1857
1858
|
return {
|
|
1858
1859
|
'info': contract,
|
|
1859
1860
|
'symbol': symbol,
|
|
@@ -1872,8 +1873,19 @@ export default class gate extends Exchange {
|
|
|
1872
1873
|
'previousFundingRate': undefined,
|
|
1873
1874
|
'previousFundingTimestamp': undefined,
|
|
1874
1875
|
'previousFundingDatetime': undefined,
|
|
1876
|
+
'interval': this.parseFundingInterval(fundingInterval),
|
|
1875
1877
|
};
|
|
1876
1878
|
}
|
|
1879
|
+
parseFundingInterval(interval) {
|
|
1880
|
+
const intervals = {
|
|
1881
|
+
'3600000': '1h',
|
|
1882
|
+
'14400000': '4h',
|
|
1883
|
+
'28800000': '8h',
|
|
1884
|
+
'57600000': '16h',
|
|
1885
|
+
'86400000': '24h',
|
|
1886
|
+
};
|
|
1887
|
+
return this.safeString(intervals, interval, interval);
|
|
1888
|
+
}
|
|
1877
1889
|
async fetchNetworkDepositAddress(code, params = {}) {
|
|
1878
1890
|
await this.loadMarkets();
|
|
1879
1891
|
const currency = this.currency(code);
|
|
@@ -4729,7 +4741,6 @@ export default class gate extends Exchange {
|
|
|
4729
4741
|
*/
|
|
4730
4742
|
await this.loadMarkets();
|
|
4731
4743
|
const until = this.safeInteger(params, 'until');
|
|
4732
|
-
params = this.omit(params, 'until');
|
|
4733
4744
|
let market = undefined;
|
|
4734
4745
|
if (symbol !== undefined) {
|
|
4735
4746
|
market = this.market(symbol);
|
|
@@ -4749,6 +4760,7 @@ export default class gate extends Exchange {
|
|
|
4749
4760
|
request['from'] = this.parseToInt(since / 1000);
|
|
4750
4761
|
}
|
|
4751
4762
|
if (until !== undefined) {
|
|
4763
|
+
params = this.omit(params, 'until');
|
|
4752
4764
|
request['to'] = this.parseToInt(until / 1000);
|
|
4753
4765
|
}
|
|
4754
4766
|
if (limit !== undefined) {
|
|
@@ -4757,7 +4769,7 @@ export default class gate extends Exchange {
|
|
|
4757
4769
|
const response = await this.privateFuturesGetSettleOrdersTimerange(this.extend(request, params));
|
|
4758
4770
|
return this.parseOrders(response, market, since, limit);
|
|
4759
4771
|
}
|
|
4760
|
-
|
|
4772
|
+
prepareOrdersByStatusRequest(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4761
4773
|
let market = undefined;
|
|
4762
4774
|
if (symbol !== undefined) {
|
|
4763
4775
|
market = this.market(symbol);
|
|
@@ -4765,9 +4777,11 @@ export default class gate extends Exchange {
|
|
|
4765
4777
|
}
|
|
4766
4778
|
const stop = this.safeBool2(params, 'stop', 'trigger');
|
|
4767
4779
|
params = this.omit(params, ['stop', 'trigger']);
|
|
4768
|
-
|
|
4780
|
+
let type = undefined;
|
|
4781
|
+
[type, params] = this.handleMarketTypeAndParams('fetchOrdersByStatus', market, params);
|
|
4769
4782
|
const spot = (type === 'spot') || (type === 'margin');
|
|
4770
|
-
|
|
4783
|
+
let request = {};
|
|
4784
|
+
[request, params] = spot ? this.multiOrderSpotPrepareRequest(market, stop, params) : this.prepareRequest(market, type, params);
|
|
4771
4785
|
if (status === 'closed') {
|
|
4772
4786
|
status = 'finished';
|
|
4773
4787
|
}
|
|
@@ -4775,10 +4789,17 @@ export default class gate extends Exchange {
|
|
|
4775
4789
|
if (limit !== undefined) {
|
|
4776
4790
|
request['limit'] = limit;
|
|
4777
4791
|
}
|
|
4778
|
-
if (
|
|
4779
|
-
|
|
4792
|
+
if (spot) {
|
|
4793
|
+
if (since !== undefined) {
|
|
4794
|
+
request['from'] = this.parseToInt(since / 1000);
|
|
4795
|
+
}
|
|
4796
|
+
const until = this.safeInteger(params, 'until');
|
|
4797
|
+
if (until !== undefined) {
|
|
4798
|
+
params = this.omit(params, 'until');
|
|
4799
|
+
request['to'] = this.parseToInt(until / 1000);
|
|
4800
|
+
}
|
|
4780
4801
|
}
|
|
4781
|
-
const [lastId, finalParams] = this.handleParamString2(
|
|
4802
|
+
const [lastId, finalParams] = this.handleParamString2(params, 'lastId', 'last_id');
|
|
4782
4803
|
if (lastId !== undefined) {
|
|
4783
4804
|
request['last_id'] = lastId;
|
|
4784
4805
|
}
|
|
@@ -4796,7 +4817,7 @@ export default class gate extends Exchange {
|
|
|
4796
4817
|
const res = this.handleMarketTypeAndParams('fetchOrdersByStatus', market, params);
|
|
4797
4818
|
const type = this.safeString(res, 0);
|
|
4798
4819
|
params['type'] = type;
|
|
4799
|
-
const [request, requestParams] = this.
|
|
4820
|
+
const [request, requestParams] = this.prepareOrdersByStatusRequest(status, symbol, since, limit, params);
|
|
4800
4821
|
const spot = (type === 'spot') || (type === 'margin');
|
|
4801
4822
|
const openSpotOrders = spot && (status === 'open') && !stop;
|
|
4802
4823
|
let response = undefined;
|