ccxt 4.4.40 → 4.4.42
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 +4 -4
- 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/alpaca.js +0 -1
- package/dist/cjs/src/ascendex.js +0 -1
- package/dist/cjs/src/base/Exchange.js +41 -19
- package/dist/cjs/src/bigone.js +0 -1
- package/dist/cjs/src/binance.js +27 -24
- package/dist/cjs/src/bingx.js +6 -1
- package/dist/cjs/src/bitfinex.js +124 -1
- package/dist/cjs/src/bitget.js +1 -0
- package/dist/cjs/src/bitmart.js +254 -1
- package/dist/cjs/src/blofin.js +16 -7
- package/dist/cjs/src/bybit.js +8 -8
- package/dist/cjs/src/cex.js +1 -1
- package/dist/cjs/src/coinbase.js +8 -9
- package/dist/cjs/src/coinbaseexchange.js +5 -6
- package/dist/cjs/src/coinbaseinternational.js +7 -8
- package/dist/cjs/src/coincatch.js +0 -1
- package/dist/cjs/src/coincheck.js +0 -1
- package/dist/cjs/src/coinex.js +91 -6
- package/dist/cjs/src/coinlist.js +3 -4
- package/dist/cjs/src/coinmate.js +1 -3
- package/dist/cjs/src/coinmetro.js +4 -5
- package/dist/cjs/src/coinone.js +0 -1
- package/dist/cjs/src/coinsph.js +7 -8
- package/dist/cjs/src/cryptocom.js +3 -0
- package/dist/cjs/src/currencycom.js +3 -4
- package/dist/cjs/src/defx.js +6 -7
- package/dist/cjs/src/deribit.js +1 -3
- package/dist/cjs/src/digifinex.js +0 -1
- package/dist/cjs/src/ellipx.js +0 -2
- package/dist/cjs/src/exmo.js +63 -6
- package/dist/cjs/src/gate.js +2 -3
- package/dist/cjs/src/gemini.js +4 -5
- package/dist/cjs/src/hashkey.js +79 -83
- package/dist/cjs/src/hitbtc.js +49 -5
- package/dist/cjs/src/hollaex.js +4 -6
- package/dist/cjs/src/htx.js +2 -4
- package/dist/cjs/src/huobijp.js +0 -1
- package/dist/cjs/src/hyperliquid.js +65 -1
- package/dist/cjs/src/idex.js +8 -8
- package/dist/cjs/src/independentreserve.js +0 -1
- package/dist/cjs/src/indodax.js +0 -1
- package/dist/cjs/src/kraken.js +192 -29
- package/dist/cjs/src/krakenfutures.js +75 -3
- package/dist/cjs/src/kucoin.js +7 -4
- package/dist/cjs/src/kucoinfutures.js +10 -9
- package/dist/cjs/src/kuna.js +1 -3
- package/dist/cjs/src/latoken.js +1 -3
- package/dist/cjs/src/lbank.js +0 -1
- package/dist/cjs/src/luno.js +0 -1
- package/dist/cjs/src/lykke.js +0 -1
- package/dist/cjs/src/mercado.js +0 -1
- package/dist/cjs/src/mexc.js +6 -7
- package/dist/cjs/src/ndax.js +1 -1
- package/dist/cjs/src/novadax.js +4 -6
- package/dist/cjs/src/oceanex.js +0 -1
- package/dist/cjs/src/okcoin.js +1 -3
- package/dist/cjs/src/okx.js +7 -4
- package/dist/cjs/src/onetrading.js +1 -3
- package/dist/cjs/src/p2b.js +1 -1
- package/dist/cjs/src/paradex.js +5 -7
- package/dist/cjs/src/phemex.js +8 -10
- package/dist/cjs/src/poloniex.js +1 -3
- package/dist/cjs/src/poloniexfutures.js +6 -6
- package/dist/cjs/src/probit.js +0 -1
- package/dist/cjs/src/timex.js +0 -1
- package/dist/cjs/src/tokocrypto.js +11 -14
- package/dist/cjs/src/tradeogre.js +1 -1
- package/dist/cjs/src/upbit.js +0 -1
- package/dist/cjs/src/wavesexchange.js +4 -5
- package/dist/cjs/src/whitebit.js +8 -9
- package/dist/cjs/src/woo.js +99 -13
- package/dist/cjs/src/woofipro.js +96 -15
- package/dist/cjs/src/xt.js +8 -4
- package/dist/cjs/src/yobit.js +0 -1
- package/dist/cjs/src/zaif.js +0 -1
- package/dist/cjs/src/zonda.js +1 -2
- package/js/ccxt.d.ts +3 -3
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +3 -0
- package/js/src/abstract/binancecoinm.d.ts +3 -0
- package/js/src/abstract/binanceus.d.ts +3 -0
- package/js/src/abstract/binanceusdm.d.ts +3 -0
- package/js/src/abstract/bitmart.d.ts +2 -0
- package/js/src/abstract/okx.d.ts +5 -0
- package/js/src/ace.js +1 -1
- package/js/src/alpaca.js +0 -1
- package/js/src/ascendex.js +0 -1
- package/js/src/base/Exchange.d.ts +12 -9
- package/js/src/base/Exchange.js +41 -19
- package/js/src/base/types.d.ts +2 -0
- package/js/src/bigone.js +0 -1
- package/js/src/binance.js +27 -24
- package/js/src/bingx.js +6 -1
- package/js/src/bitfinex.d.ts +11 -1
- package/js/src/bitfinex.js +124 -1
- package/js/src/bitget.js +1 -0
- package/js/src/bitmart.d.ts +52 -1
- package/js/src/bitmart.js +254 -1
- package/js/src/blofin.d.ts +1 -1
- package/js/src/blofin.js +16 -7
- package/js/src/bybit.js +8 -8
- package/js/src/cex.js +1 -1
- package/js/src/coinbase.js +8 -9
- package/js/src/coinbaseexchange.js +5 -6
- package/js/src/coinbaseinternational.d.ts +1 -1
- package/js/src/coinbaseinternational.js +7 -8
- package/js/src/coincatch.js +0 -1
- package/js/src/coincheck.js +0 -1
- package/js/src/coinex.js +91 -6
- package/js/src/coinlist.js +3 -4
- package/js/src/coinmate.js +1 -3
- package/js/src/coinmetro.js +4 -5
- package/js/src/coinone.js +0 -1
- package/js/src/coinsph.js +7 -8
- package/js/src/cryptocom.js +3 -0
- package/js/src/currencycom.js +3 -4
- package/js/src/defx.js +6 -7
- package/js/src/deribit.js +1 -3
- package/js/src/digifinex.js +0 -1
- package/js/src/ellipx.js +0 -2
- package/js/src/exmo.d.ts +36 -1
- package/js/src/exmo.js +63 -6
- package/js/src/gate.d.ts +1 -1
- package/js/src/gate.js +2 -3
- package/js/src/gemini.js +4 -5
- package/js/src/hashkey.js +79 -83
- package/js/src/hitbtc.d.ts +11 -1
- package/js/src/hitbtc.js +49 -5
- package/js/src/hollaex.js +4 -6
- package/js/src/htx.js +2 -4
- package/js/src/huobijp.js +0 -1
- package/js/src/hyperliquid.d.ts +20 -1
- package/js/src/hyperliquid.js +65 -1
- package/js/src/idex.js +8 -8
- package/js/src/independentreserve.js +0 -1
- package/js/src/indodax.js +0 -1
- package/js/src/kraken.d.ts +15 -9
- package/js/src/kraken.js +192 -29
- package/js/src/krakenfutures.d.ts +2 -2
- package/js/src/krakenfutures.js +75 -3
- package/js/src/kucoin.js +7 -4
- package/js/src/kucoinfutures.d.ts +5 -4
- package/js/src/kucoinfutures.js +10 -9
- package/js/src/kuna.js +1 -3
- package/js/src/latoken.js +1 -3
- package/js/src/lbank.js +0 -1
- package/js/src/luno.js +0 -1
- package/js/src/lykke.js +0 -1
- package/js/src/mercado.js +0 -1
- package/js/src/mexc.js +6 -7
- package/js/src/ndax.js +1 -1
- package/js/src/novadax.js +4 -6
- package/js/src/oceanex.js +0 -1
- package/js/src/okcoin.js +1 -3
- package/js/src/okx.js +7 -4
- package/js/src/onetrading.js +1 -3
- package/js/src/p2b.js +1 -1
- package/js/src/paradex.d.ts +1 -1
- package/js/src/paradex.js +5 -7
- package/js/src/phemex.js +8 -10
- package/js/src/poloniex.js +1 -3
- package/js/src/poloniexfutures.js +6 -6
- package/js/src/probit.js +0 -1
- package/js/src/timex.js +0 -1
- package/js/src/tokocrypto.js +11 -14
- package/js/src/tradeogre.js +1 -1
- package/js/src/upbit.js +0 -1
- package/js/src/wavesexchange.d.ts +1 -1
- package/js/src/wavesexchange.js +4 -5
- package/js/src/whitebit.js +8 -9
- package/js/src/woo.d.ts +1 -1
- package/js/src/woo.js +99 -13
- package/js/src/woofipro.js +96 -15
- package/js/src/xt.d.ts +2 -1
- package/js/src/xt.js +8 -4
- package/js/src/yobit.js +0 -1
- package/js/src/zaif.js +0 -1
- package/js/src/zonda.js +1 -2
- package/package.json +2 -2
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -62,12 +62,13 @@ class bitmart extends bitmart$1 {
|
|
|
62
62
|
'fetchDeposits': true,
|
|
63
63
|
'fetchDepositWithdrawFee': true,
|
|
64
64
|
'fetchDepositWithdrawFees': false,
|
|
65
|
-
'fetchFundingHistory':
|
|
65
|
+
'fetchFundingHistory': true,
|
|
66
66
|
'fetchFundingRate': true,
|
|
67
67
|
'fetchFundingRateHistory': false,
|
|
68
68
|
'fetchFundingRates': false,
|
|
69
69
|
'fetchIsolatedBorrowRate': true,
|
|
70
70
|
'fetchIsolatedBorrowRates': true,
|
|
71
|
+
'fetchLedger': true,
|
|
71
72
|
'fetchLiquidations': false,
|
|
72
73
|
'fetchMarginMode': false,
|
|
73
74
|
'fetchMarkets': true,
|
|
@@ -154,6 +155,7 @@ class bitmart extends bitmart$1 {
|
|
|
154
155
|
'contract/public/depth': 5,
|
|
155
156
|
'contract/public/open-interest': 30,
|
|
156
157
|
'contract/public/funding-rate': 30,
|
|
158
|
+
'contract/public/funding-rate-history': 30,
|
|
157
159
|
'contract/public/kline': 6,
|
|
158
160
|
'account/v1/currencies': 30,
|
|
159
161
|
},
|
|
@@ -204,6 +206,7 @@ class bitmart extends bitmart$1 {
|
|
|
204
206
|
'contract/private/position-risk': 10,
|
|
205
207
|
'contract/private/affilate/rebate-list': 10,
|
|
206
208
|
'contract/private/affilate/trade-list': 10,
|
|
209
|
+
'contract/private/transaction-history': 10,
|
|
207
210
|
},
|
|
208
211
|
'post': {
|
|
209
212
|
// sub-account endpoints
|
|
@@ -4615,6 +4618,65 @@ class bitmart extends bitmart$1 {
|
|
|
4615
4618
|
const data = this.safeDict(response, 'data', {});
|
|
4616
4619
|
return this.parseFundingRate(data, market);
|
|
4617
4620
|
}
|
|
4621
|
+
/**
|
|
4622
|
+
* @method
|
|
4623
|
+
* @name bitmart#fetchFundingRateHistory
|
|
4624
|
+
* @description fetches historical funding rate prices
|
|
4625
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-funding-rate-history
|
|
4626
|
+
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
4627
|
+
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
4628
|
+
* @param {int} [limit] the maximum amount of funding rate structures to fetch
|
|
4629
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4630
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
|
|
4631
|
+
*/
|
|
4632
|
+
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4633
|
+
if (symbol === undefined) {
|
|
4634
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
|
|
4635
|
+
}
|
|
4636
|
+
await this.loadMarkets();
|
|
4637
|
+
const market = this.market(symbol);
|
|
4638
|
+
const request = {
|
|
4639
|
+
'symbol': market['id'],
|
|
4640
|
+
};
|
|
4641
|
+
if (limit !== undefined) {
|
|
4642
|
+
request['limit'] = limit;
|
|
4643
|
+
}
|
|
4644
|
+
const response = await this.publicGetContractPublicFundingRateHistory(this.extend(request, params));
|
|
4645
|
+
//
|
|
4646
|
+
// {
|
|
4647
|
+
// "code": 1000,
|
|
4648
|
+
// "message": "Ok",
|
|
4649
|
+
// "data": {
|
|
4650
|
+
// "list": [
|
|
4651
|
+
// {
|
|
4652
|
+
// "symbol": "BTCUSDT",
|
|
4653
|
+
// "funding_rate": "0.000091412174",
|
|
4654
|
+
// "funding_time": "1734336000000"
|
|
4655
|
+
// },
|
|
4656
|
+
// ]
|
|
4657
|
+
// },
|
|
4658
|
+
// "trace": "fg73d949fgfdf6a40c8fc7f5ae6738.54.345345345345"
|
|
4659
|
+
// }
|
|
4660
|
+
//
|
|
4661
|
+
const data = this.safeDict(response, 'data', {});
|
|
4662
|
+
const result = this.safeList(data, 'list', []);
|
|
4663
|
+
const rates = [];
|
|
4664
|
+
for (let i = 0; i < result.length; i++) {
|
|
4665
|
+
const entry = result[i];
|
|
4666
|
+
const marketId = this.safeString(entry, 'symbol');
|
|
4667
|
+
const symbolInner = this.safeSymbol(marketId, market, '-', 'swap');
|
|
4668
|
+
const timestamp = this.safeInteger(entry, 'funding_time');
|
|
4669
|
+
rates.push({
|
|
4670
|
+
'info': entry,
|
|
4671
|
+
'symbol': symbolInner,
|
|
4672
|
+
'fundingRate': this.safeNumber(entry, 'funding_rate'),
|
|
4673
|
+
'timestamp': timestamp,
|
|
4674
|
+
'datetime': this.iso8601(timestamp),
|
|
4675
|
+
});
|
|
4676
|
+
}
|
|
4677
|
+
const sorted = this.sortBy(rates, 'timestamp');
|
|
4678
|
+
return this.filterBySymbolSinceLimit(sorted, market['symbol'], since, limit);
|
|
4679
|
+
}
|
|
4618
4680
|
parseFundingRate(contract, market = undefined) {
|
|
4619
4681
|
//
|
|
4620
4682
|
// {
|
|
@@ -5049,6 +5111,197 @@ class bitmart extends bitmart$1 {
|
|
|
5049
5111
|
const data = this.safeDict(response, 'data', {});
|
|
5050
5112
|
return this.parseOrder(data, market);
|
|
5051
5113
|
}
|
|
5114
|
+
/**
|
|
5115
|
+
* @method
|
|
5116
|
+
* @name bitmart#fetchLedger
|
|
5117
|
+
* @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
5118
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-transaction-history-keyed
|
|
5119
|
+
* @param {string} [code] unified currency code
|
|
5120
|
+
* @param {int} [since] timestamp in ms of the earliest ledger entry
|
|
5121
|
+
* @param {int} [limit] max number of ledger entries to return
|
|
5122
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5123
|
+
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
5124
|
+
* @returns {object[]} a list of [ledger structures]{@link https://docs.ccxt.com/#/?id=ledger}
|
|
5125
|
+
*/
|
|
5126
|
+
async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
5127
|
+
await this.loadMarkets();
|
|
5128
|
+
let currency = undefined;
|
|
5129
|
+
if (code !== undefined) {
|
|
5130
|
+
currency = this.currency(code);
|
|
5131
|
+
}
|
|
5132
|
+
let request = {};
|
|
5133
|
+
[request, params] = this.handleUntilOption('end_time', request, params);
|
|
5134
|
+
const transactionsRequest = this.fetchTransactionsRequest(0, undefined, since, limit, params);
|
|
5135
|
+
const response = await this.privateGetContractPrivateTransactionHistory(transactionsRequest);
|
|
5136
|
+
//
|
|
5137
|
+
// {
|
|
5138
|
+
// "code": 1000,
|
|
5139
|
+
// "message": "Ok",
|
|
5140
|
+
// "data": [
|
|
5141
|
+
// {
|
|
5142
|
+
// "time": "1734422402121",
|
|
5143
|
+
// "type": "Funding Fee",
|
|
5144
|
+
// "amount": "-0.00008253",
|
|
5145
|
+
// "asset": "USDT",
|
|
5146
|
+
// "symbol": "LTCUSDT",
|
|
5147
|
+
// "tran_id": "1734422402121",
|
|
5148
|
+
// "flow_type": 3
|
|
5149
|
+
// },
|
|
5150
|
+
// ],
|
|
5151
|
+
// "trace": "4cd11f83c71egfhfgh842790f07241e.23.173442343427772866"
|
|
5152
|
+
// }
|
|
5153
|
+
//
|
|
5154
|
+
const data = this.safeList(response, 'data', []);
|
|
5155
|
+
return this.parseLedger(data, currency, since, limit);
|
|
5156
|
+
}
|
|
5157
|
+
parseLedgerEntry(item, currency = undefined) {
|
|
5158
|
+
//
|
|
5159
|
+
// {
|
|
5160
|
+
// "time": "1734422402121",
|
|
5161
|
+
// "type": "Funding Fee",
|
|
5162
|
+
// "amount": "-0.00008253",
|
|
5163
|
+
// "asset": "USDT",
|
|
5164
|
+
// "symbol": "LTCUSDT",
|
|
5165
|
+
// "tran_id": "1734422402121",
|
|
5166
|
+
// "flow_type": 3
|
|
5167
|
+
// }
|
|
5168
|
+
//
|
|
5169
|
+
let amount = this.safeString(item, 'amount');
|
|
5170
|
+
let direction = undefined;
|
|
5171
|
+
if (Precise["default"].stringLe(amount, '0')) {
|
|
5172
|
+
direction = 'out';
|
|
5173
|
+
amount = Precise["default"].stringMul('-1', amount);
|
|
5174
|
+
}
|
|
5175
|
+
else {
|
|
5176
|
+
direction = 'in';
|
|
5177
|
+
}
|
|
5178
|
+
const currencyId = this.safeString(item, 'asset');
|
|
5179
|
+
const timestamp = this.safeInteger(item, 'time');
|
|
5180
|
+
const type = this.safeString(item, 'type');
|
|
5181
|
+
return this.safeLedgerEntry({
|
|
5182
|
+
'info': item,
|
|
5183
|
+
'id': this.safeString(item, 'tran_id'),
|
|
5184
|
+
'direction': direction,
|
|
5185
|
+
'account': undefined,
|
|
5186
|
+
'referenceAccount': undefined,
|
|
5187
|
+
'referenceId': this.safeString(item, 'tradeId'),
|
|
5188
|
+
'type': this.parseLedgerEntryType(type),
|
|
5189
|
+
'currency': this.safeCurrencyCode(currencyId, currency),
|
|
5190
|
+
'amount': this.parseNumber(amount),
|
|
5191
|
+
'timestamp': timestamp,
|
|
5192
|
+
'datetime': this.iso8601(timestamp),
|
|
5193
|
+
'before': undefined,
|
|
5194
|
+
'after': undefined,
|
|
5195
|
+
'status': undefined,
|
|
5196
|
+
'fee': undefined,
|
|
5197
|
+
}, currency);
|
|
5198
|
+
}
|
|
5199
|
+
parseLedgerEntryType(type) {
|
|
5200
|
+
const ledgerType = {
|
|
5201
|
+
'Commission Fee': 'fee',
|
|
5202
|
+
'Funding Fee': 'fee',
|
|
5203
|
+
'Realized PNL': 'trade',
|
|
5204
|
+
'Transfer': 'transfer',
|
|
5205
|
+
'Liquidation Clearance': 'settlement',
|
|
5206
|
+
};
|
|
5207
|
+
return this.safeString(ledgerType, type, type);
|
|
5208
|
+
}
|
|
5209
|
+
fetchTransactionsRequest(flowType = undefined, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
5210
|
+
let request = {};
|
|
5211
|
+
if (flowType !== undefined) {
|
|
5212
|
+
request['flow_type'] = flowType;
|
|
5213
|
+
}
|
|
5214
|
+
let market = undefined;
|
|
5215
|
+
if (symbol !== undefined) {
|
|
5216
|
+
market = this.market(symbol);
|
|
5217
|
+
request['symbol'] = market['id'];
|
|
5218
|
+
}
|
|
5219
|
+
if (since !== undefined) {
|
|
5220
|
+
request['start_time'] = since;
|
|
5221
|
+
}
|
|
5222
|
+
if (limit !== undefined) {
|
|
5223
|
+
request['page_size'] = limit;
|
|
5224
|
+
}
|
|
5225
|
+
[request, params] = this.handleUntilOption('end_time', request, params);
|
|
5226
|
+
return this.extend(request, params);
|
|
5227
|
+
}
|
|
5228
|
+
/**
|
|
5229
|
+
* @method
|
|
5230
|
+
* @name bitmart#fetchFundingHistory
|
|
5231
|
+
* @description fetch the history of funding payments paid and received on this account
|
|
5232
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-transaction-history-keyed
|
|
5233
|
+
* @param {string} [symbol] unified market symbol
|
|
5234
|
+
* @param {int} [since] the starting timestamp in milliseconds
|
|
5235
|
+
* @param {int} [limit] the number of entries to return
|
|
5236
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5237
|
+
* @param {int} [params.until] the latest time in ms to fetch funding history for
|
|
5238
|
+
* @returns {object[]} a list of [funding history structures]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
5239
|
+
*/
|
|
5240
|
+
async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
5241
|
+
await this.loadMarkets();
|
|
5242
|
+
let market = undefined;
|
|
5243
|
+
if (symbol !== undefined) {
|
|
5244
|
+
market = this.market(symbol);
|
|
5245
|
+
}
|
|
5246
|
+
let request = {};
|
|
5247
|
+
[request, params] = this.handleUntilOption('end_time', request, params);
|
|
5248
|
+
const transactionsRequest = this.fetchTransactionsRequest(3, symbol, since, limit, params);
|
|
5249
|
+
const response = await this.privateGetContractPrivateTransactionHistory(transactionsRequest);
|
|
5250
|
+
//
|
|
5251
|
+
// {
|
|
5252
|
+
// "code": 1000,
|
|
5253
|
+
// "message": "Ok",
|
|
5254
|
+
// "data": [
|
|
5255
|
+
// {
|
|
5256
|
+
// "time": "1734422402121",
|
|
5257
|
+
// "type": "Funding Fee",
|
|
5258
|
+
// "amount": "-0.00008253",
|
|
5259
|
+
// "asset": "USDT",
|
|
5260
|
+
// "symbol": "LTCUSDT",
|
|
5261
|
+
// "tran_id": "1734422402121",
|
|
5262
|
+
// "flow_type": 3
|
|
5263
|
+
// },
|
|
5264
|
+
// ],
|
|
5265
|
+
// "trace": "4cd11f83c71egfhfgh842790f07241e.23.173442343427772866"
|
|
5266
|
+
// }
|
|
5267
|
+
//
|
|
5268
|
+
const data = this.safeList(response, 'data', []);
|
|
5269
|
+
return this.parseFundingHistories(data, market, since, limit);
|
|
5270
|
+
}
|
|
5271
|
+
parseFundingHistory(contract, market = undefined) {
|
|
5272
|
+
//
|
|
5273
|
+
// {
|
|
5274
|
+
// "time": "1734422402121",
|
|
5275
|
+
// "type": "Funding Fee",
|
|
5276
|
+
// "amount": "-0.00008253",
|
|
5277
|
+
// "asset": "USDT",
|
|
5278
|
+
// "symbol": "LTCUSDT",
|
|
5279
|
+
// "tran_id": "1734422402121",
|
|
5280
|
+
// "flow_type": 3
|
|
5281
|
+
// }
|
|
5282
|
+
//
|
|
5283
|
+
const marketId = this.safeString(contract, 'symbol');
|
|
5284
|
+
const currencyId = this.safeString(contract, 'asset');
|
|
5285
|
+
const timestamp = this.safeInteger(contract, 'time');
|
|
5286
|
+
return {
|
|
5287
|
+
'info': contract,
|
|
5288
|
+
'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
|
|
5289
|
+
'code': this.safeCurrencyCode(currencyId),
|
|
5290
|
+
'timestamp': timestamp,
|
|
5291
|
+
'datetime': this.iso8601(timestamp),
|
|
5292
|
+
'id': this.safeString(contract, 'tran_id'),
|
|
5293
|
+
'amount': this.safeNumber(contract, 'amount'),
|
|
5294
|
+
};
|
|
5295
|
+
}
|
|
5296
|
+
parseFundingHistories(contracts, market = undefined, since = undefined, limit = undefined) {
|
|
5297
|
+
const result = [];
|
|
5298
|
+
for (let i = 0; i < contracts.length; i++) {
|
|
5299
|
+
const contract = contracts[i];
|
|
5300
|
+
result.push(this.parseFundingHistory(contract, market));
|
|
5301
|
+
}
|
|
5302
|
+
const sorted = this.sortBy(result, 'timestamp');
|
|
5303
|
+
return this.filterBySinceLimit(sorted, since, limit);
|
|
5304
|
+
}
|
|
5052
5305
|
nonce() {
|
|
5053
5306
|
return this.milliseconds();
|
|
5054
5307
|
}
|
package/dist/cjs/src/blofin.js
CHANGED
|
@@ -158,7 +158,7 @@ class blofin extends blofin$1 {
|
|
|
158
158
|
'rest': 'https://openapi.blofin.com',
|
|
159
159
|
},
|
|
160
160
|
'referral': {
|
|
161
|
-
'url': 'https://blofin.com/register?referral_code=
|
|
161
|
+
'url': 'https://blofin.com/register?referral_code=f79EsS',
|
|
162
162
|
'discount': 0.05,
|
|
163
163
|
},
|
|
164
164
|
'www': 'https://www.blofin.com',
|
|
@@ -278,10 +278,18 @@ class blofin extends blofin$1 {
|
|
|
278
278
|
'brokerId': 'ec6dd3a7dd982d0b',
|
|
279
279
|
'accountsByType': {
|
|
280
280
|
'swap': 'futures',
|
|
281
|
+
'funding': 'funding',
|
|
281
282
|
'future': 'futures',
|
|
283
|
+
'copy_trading': 'copy_trading',
|
|
284
|
+
'earn': 'earn',
|
|
285
|
+
'spot': 'spot',
|
|
282
286
|
},
|
|
283
287
|
'accountsById': {
|
|
288
|
+
'funding': 'funding',
|
|
284
289
|
'futures': 'swap',
|
|
290
|
+
'copy_trading': 'copy_trading',
|
|
291
|
+
'earn': 'earn',
|
|
292
|
+
'spot': 'spot',
|
|
285
293
|
},
|
|
286
294
|
'sandboxMode': false,
|
|
287
295
|
'defaultNetwork': 'ERC20',
|
|
@@ -879,8 +887,9 @@ class blofin extends blofin$1 {
|
|
|
879
887
|
const entry = this.safeDict(data, 0, {});
|
|
880
888
|
return this.parseFundingRate(entry, market);
|
|
881
889
|
}
|
|
882
|
-
parseBalanceByType(
|
|
883
|
-
|
|
890
|
+
parseBalanceByType(response) {
|
|
891
|
+
const data = this.safeList(response, 'data');
|
|
892
|
+
if ((data !== undefined) && Array.isArray(data)) {
|
|
884
893
|
return this.parseFundingBalance(response);
|
|
885
894
|
}
|
|
886
895
|
else {
|
|
@@ -998,11 +1007,11 @@ class blofin extends blofin$1 {
|
|
|
998
1007
|
*/
|
|
999
1008
|
async fetchBalance(params = {}) {
|
|
1000
1009
|
await this.loadMarkets();
|
|
1001
|
-
|
|
1002
|
-
params = this.
|
|
1010
|
+
let accountType = undefined;
|
|
1011
|
+
[accountType, params] = this.handleOptionAndParams2(params, 'fetchBalance', 'accountType', 'type');
|
|
1003
1012
|
const request = {};
|
|
1004
1013
|
let response = undefined;
|
|
1005
|
-
if (accountType !== undefined) {
|
|
1014
|
+
if (accountType !== undefined && accountType !== 'swap') {
|
|
1006
1015
|
const options = this.safeDict(this.options, 'accountsByType', {});
|
|
1007
1016
|
const parsedAccountType = this.safeString(options, accountType, accountType);
|
|
1008
1017
|
request['accountType'] = parsedAccountType;
|
|
@@ -1011,7 +1020,7 @@ class blofin extends blofin$1 {
|
|
|
1011
1020
|
else {
|
|
1012
1021
|
response = await this.privateGetAccountBalance(this.extend(request, params));
|
|
1013
1022
|
}
|
|
1014
|
-
return this.parseBalanceByType(
|
|
1023
|
+
return this.parseBalanceByType(response);
|
|
1015
1024
|
}
|
|
1016
1025
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1017
1026
|
const market = this.market(symbol);
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -3682,33 +3682,33 @@ class bybit extends bybit$1 {
|
|
|
3682
3682
|
const avgPrice = this.omitZero(this.safeString(order, 'avgPrice'));
|
|
3683
3683
|
const rawTimeInForce = this.safeString(order, 'timeInForce');
|
|
3684
3684
|
const timeInForce = this.parseTimeInForce(rawTimeInForce);
|
|
3685
|
-
const
|
|
3685
|
+
const triggerPrice = this.omitZero(this.safeString(order, 'triggerPrice'));
|
|
3686
3686
|
const reduceOnly = this.safeBool(order, 'reduceOnly');
|
|
3687
3687
|
let takeProfitPrice = this.omitZero(this.safeString(order, 'takeProfit'));
|
|
3688
3688
|
let stopLossPrice = this.omitZero(this.safeString(order, 'stopLoss'));
|
|
3689
3689
|
const triggerDirection = this.safeString(order, 'triggerDirection');
|
|
3690
3690
|
const isAscending = (triggerDirection === '1');
|
|
3691
|
-
const isStopOrderType2 = (
|
|
3691
|
+
const isStopOrderType2 = (triggerPrice !== undefined) && reduceOnly;
|
|
3692
3692
|
if ((stopLossPrice === undefined) && isStopOrderType2) {
|
|
3693
3693
|
// check if order is stop order type 2 - stopLossPrice
|
|
3694
3694
|
if (isAscending && (side === 'buy')) {
|
|
3695
3695
|
// stopLoss order against short position
|
|
3696
|
-
stopLossPrice =
|
|
3696
|
+
stopLossPrice = triggerPrice;
|
|
3697
3697
|
}
|
|
3698
3698
|
if (!isAscending && (side === 'sell')) {
|
|
3699
3699
|
// stopLoss order against a long position
|
|
3700
|
-
stopLossPrice =
|
|
3700
|
+
stopLossPrice = triggerPrice;
|
|
3701
3701
|
}
|
|
3702
3702
|
}
|
|
3703
3703
|
if ((takeProfitPrice === undefined) && isStopOrderType2) {
|
|
3704
3704
|
// check if order is stop order type 2 - takeProfitPrice
|
|
3705
3705
|
if (isAscending && (side === 'sell')) {
|
|
3706
3706
|
// takeprofit order against a long position
|
|
3707
|
-
takeProfitPrice =
|
|
3707
|
+
takeProfitPrice = triggerPrice;
|
|
3708
3708
|
}
|
|
3709
3709
|
if (!isAscending && (side === 'buy')) {
|
|
3710
3710
|
// takeprofit order against a short position
|
|
3711
|
-
takeProfitPrice =
|
|
3711
|
+
takeProfitPrice = triggerPrice;
|
|
3712
3712
|
}
|
|
3713
3713
|
}
|
|
3714
3714
|
return this.safeOrder({
|
|
@@ -3726,7 +3726,7 @@ class bybit extends bybit$1 {
|
|
|
3726
3726
|
'reduceOnly': this.safeBool(order, 'reduceOnly'),
|
|
3727
3727
|
'side': side,
|
|
3728
3728
|
'price': price,
|
|
3729
|
-
'triggerPrice':
|
|
3729
|
+
'triggerPrice': triggerPrice,
|
|
3730
3730
|
'takeProfitPrice': takeProfitPrice,
|
|
3731
3731
|
'stopLossPrice': stopLossPrice,
|
|
3732
3732
|
'amount': amount,
|
|
@@ -6754,7 +6754,7 @@ class bybit extends bybit$1 {
|
|
|
6754
6754
|
const data = this.addPaginationCursorToResult(response);
|
|
6755
6755
|
const id = this.safeString(result, 'symbol');
|
|
6756
6756
|
market = this.safeMarket(id, market, undefined, 'contract');
|
|
6757
|
-
return this.
|
|
6757
|
+
return this.parseOpenInterestsHistory(data, market, since, limit);
|
|
6758
6758
|
}
|
|
6759
6759
|
/**
|
|
6760
6760
|
* @method
|
package/dist/cjs/src/cex.js
CHANGED
|
@@ -1087,7 +1087,7 @@ class cex extends cex$1 {
|
|
|
1087
1087
|
'postOnly': undefined,
|
|
1088
1088
|
'side': this.safeStringLower(order, 'side'),
|
|
1089
1089
|
'price': this.safeNumber(order, 'price'),
|
|
1090
|
-
'
|
|
1090
|
+
'triggerPrice': this.safeNumber(order, 'stopPrice'),
|
|
1091
1091
|
'amount': requestedBase,
|
|
1092
1092
|
'cost': executedQuote,
|
|
1093
1093
|
'average': this.safeNumber(order, 'averagePrice'),
|
package/dist/cjs/src/coinbase.js
CHANGED
|
@@ -2890,10 +2890,10 @@ class coinbase extends coinbase$1 {
|
|
|
2890
2890
|
'product_id': market['id'],
|
|
2891
2891
|
'side': side.toUpperCase(),
|
|
2892
2892
|
};
|
|
2893
|
-
const
|
|
2893
|
+
const triggerPrice = this.safeNumberN(params, ['stopPrice', 'stop_price', 'triggerPrice']);
|
|
2894
2894
|
const stopLossPrice = this.safeNumber(params, 'stopLossPrice');
|
|
2895
2895
|
const takeProfitPrice = this.safeNumber(params, 'takeProfitPrice');
|
|
2896
|
-
const isStop =
|
|
2896
|
+
const isStop = triggerPrice !== undefined;
|
|
2897
2897
|
const isStopLoss = stopLossPrice !== undefined;
|
|
2898
2898
|
const isTakeProfit = takeProfitPrice !== undefined;
|
|
2899
2899
|
const timeInForce = this.safeString(params, 'timeInForce');
|
|
@@ -2913,7 +2913,7 @@ class coinbase extends coinbase$1 {
|
|
|
2913
2913
|
'stop_limit_stop_limit_gtd': {
|
|
2914
2914
|
'base_size': this.amountToPrecision(symbol, amount),
|
|
2915
2915
|
'limit_price': this.priceToPrecision(symbol, price),
|
|
2916
|
-
'stop_price': this.priceToPrecision(symbol,
|
|
2916
|
+
'stop_price': this.priceToPrecision(symbol, triggerPrice),
|
|
2917
2917
|
'stop_direction': stopDirection,
|
|
2918
2918
|
'end_time': endTime,
|
|
2919
2919
|
},
|
|
@@ -2924,31 +2924,31 @@ class coinbase extends coinbase$1 {
|
|
|
2924
2924
|
'stop_limit_stop_limit_gtc': {
|
|
2925
2925
|
'base_size': this.amountToPrecision(symbol, amount),
|
|
2926
2926
|
'limit_price': this.priceToPrecision(symbol, price),
|
|
2927
|
-
'stop_price': this.priceToPrecision(symbol,
|
|
2927
|
+
'stop_price': this.priceToPrecision(symbol, triggerPrice),
|
|
2928
2928
|
'stop_direction': stopDirection,
|
|
2929
2929
|
},
|
|
2930
2930
|
};
|
|
2931
2931
|
}
|
|
2932
2932
|
}
|
|
2933
2933
|
else if (isStopLoss || isTakeProfit) {
|
|
2934
|
-
let
|
|
2934
|
+
let tpslPrice = undefined;
|
|
2935
2935
|
if (isStopLoss) {
|
|
2936
2936
|
if (stopDirection === undefined) {
|
|
2937
2937
|
stopDirection = (side === 'buy') ? 'STOP_DIRECTION_STOP_UP' : 'STOP_DIRECTION_STOP_DOWN';
|
|
2938
2938
|
}
|
|
2939
|
-
|
|
2939
|
+
tpslPrice = this.priceToPrecision(symbol, stopLossPrice);
|
|
2940
2940
|
}
|
|
2941
2941
|
else {
|
|
2942
2942
|
if (stopDirection === undefined) {
|
|
2943
2943
|
stopDirection = (side === 'buy') ? 'STOP_DIRECTION_STOP_DOWN' : 'STOP_DIRECTION_STOP_UP';
|
|
2944
2944
|
}
|
|
2945
|
-
|
|
2945
|
+
tpslPrice = this.priceToPrecision(symbol, takeProfitPrice);
|
|
2946
2946
|
}
|
|
2947
2947
|
request['order_configuration'] = {
|
|
2948
2948
|
'stop_limit_stop_limit_gtc': {
|
|
2949
2949
|
'base_size': this.amountToPrecision(symbol, amount),
|
|
2950
2950
|
'limit_price': this.priceToPrecision(symbol, price),
|
|
2951
|
-
'stop_price':
|
|
2951
|
+
'stop_price': tpslPrice,
|
|
2952
2952
|
'stop_direction': stopDirection,
|
|
2953
2953
|
},
|
|
2954
2954
|
};
|
|
@@ -3231,7 +3231,6 @@ class coinbase extends coinbase$1 {
|
|
|
3231
3231
|
'postOnly': postOnly,
|
|
3232
3232
|
'side': this.safeStringLower(order, 'side'),
|
|
3233
3233
|
'price': price,
|
|
3234
|
-
'stopPrice': triggerPrice,
|
|
3235
3234
|
'triggerPrice': triggerPrice,
|
|
3236
3235
|
'amount': amount,
|
|
3237
3236
|
'filled': this.safeString(order, 'filled_size'),
|
|
@@ -1061,7 +1061,7 @@ class coinbaseexchange extends coinbaseexchange$1 {
|
|
|
1061
1061
|
const side = this.safeString(order, 'side');
|
|
1062
1062
|
const timeInForce = this.safeString(order, 'time_in_force');
|
|
1063
1063
|
const postOnly = this.safeValue(order, 'post_only');
|
|
1064
|
-
const
|
|
1064
|
+
const triggerPrice = this.safeNumber(order, 'stop_price');
|
|
1065
1065
|
const clientOrderId = this.safeString(order, 'client_oid');
|
|
1066
1066
|
return this.safeOrder({
|
|
1067
1067
|
'id': id,
|
|
@@ -1077,8 +1077,7 @@ class coinbaseexchange extends coinbaseexchange$1 {
|
|
|
1077
1077
|
'postOnly': postOnly,
|
|
1078
1078
|
'side': side,
|
|
1079
1079
|
'price': price,
|
|
1080
|
-
'
|
|
1081
|
-
'triggerPrice': stopPrice,
|
|
1080
|
+
'triggerPrice': triggerPrice,
|
|
1082
1081
|
'cost': cost,
|
|
1083
1082
|
'amount': amount,
|
|
1084
1083
|
'filled': filled,
|
|
@@ -1254,9 +1253,9 @@ class coinbaseexchange extends coinbaseexchange$1 {
|
|
|
1254
1253
|
if (clientOrderId !== undefined) {
|
|
1255
1254
|
request['client_oid'] = clientOrderId;
|
|
1256
1255
|
}
|
|
1257
|
-
const
|
|
1258
|
-
if (
|
|
1259
|
-
request['stop_price'] = this.priceToPrecision(symbol,
|
|
1256
|
+
const triggerPrice = this.safeNumberN(params, ['stopPrice', 'stop_price', 'triggerPrice']);
|
|
1257
|
+
if (triggerPrice !== undefined) {
|
|
1258
|
+
request['stop_price'] = this.priceToPrecision(symbol, triggerPrice);
|
|
1260
1259
|
}
|
|
1261
1260
|
const timeInForce = this.safeString2(params, 'timeInForce', 'time_in_force');
|
|
1262
1261
|
if (timeInForce !== undefined) {
|
|
@@ -1678,7 +1678,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
1678
1678
|
* @param {float} amount how much you want to trade in units of the base currency, quote currency for 'market' 'buy' orders
|
|
1679
1679
|
* @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
|
|
1680
1680
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1681
|
-
* @param {float} [params.stopPrice]
|
|
1681
|
+
* @param {float} [params.stopPrice] alias for triggerPrice
|
|
1682
1682
|
* @param {float} [params.triggerPrice] price to trigger stop orders
|
|
1683
1683
|
* @param {float} [params.stopLossPrice] price to trigger stop-loss orders
|
|
1684
1684
|
* @param {bool} [params.postOnly] true or false
|
|
@@ -1691,7 +1691,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
1691
1691
|
await this.loadMarkets();
|
|
1692
1692
|
const market = this.market(symbol);
|
|
1693
1693
|
let typeId = type.toUpperCase();
|
|
1694
|
-
const
|
|
1694
|
+
const triggerPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
|
|
1695
1695
|
const clientOrderIdprefix = this.safeString(this.options, 'brokerId', 'nfqkvdjp');
|
|
1696
1696
|
let clientOrderId = clientOrderIdprefix + '-' + this.uuid();
|
|
1697
1697
|
clientOrderId = clientOrderId.slice(0, 17);
|
|
@@ -1701,14 +1701,14 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
1701
1701
|
'instrument': market['id'],
|
|
1702
1702
|
'size': this.amountToPrecision(market['symbol'], amount),
|
|
1703
1703
|
};
|
|
1704
|
-
if (
|
|
1704
|
+
if (triggerPrice !== undefined) {
|
|
1705
1705
|
if (type === 'limit') {
|
|
1706
1706
|
typeId = 'STOP_LIMIT';
|
|
1707
1707
|
}
|
|
1708
1708
|
else {
|
|
1709
1709
|
typeId = 'STOP';
|
|
1710
1710
|
}
|
|
1711
|
-
request['stop_price'] =
|
|
1711
|
+
request['stop_price'] = triggerPrice;
|
|
1712
1712
|
}
|
|
1713
1713
|
request['type'] = typeId;
|
|
1714
1714
|
if (type === 'limit') {
|
|
@@ -1811,7 +1811,6 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
1811
1811
|
'postOnly': undefined,
|
|
1812
1812
|
'side': this.safeStringLower(order, 'side'),
|
|
1813
1813
|
'price': this.safeString(order, 'price'),
|
|
1814
|
-
'stopPrice': this.safeString(order, 'stop_price'),
|
|
1815
1814
|
'triggerPrice': this.safeString(order, 'stop_price'),
|
|
1816
1815
|
'amount': this.safeString(order, 'size'),
|
|
1817
1816
|
'filled': this.safeString(order, 'exec_qty'),
|
|
@@ -1953,9 +1952,9 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
1953
1952
|
if (price !== undefined) {
|
|
1954
1953
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
1955
1954
|
}
|
|
1956
|
-
const
|
|
1957
|
-
if (
|
|
1958
|
-
request['stop_price'] =
|
|
1955
|
+
const triggerPrice = this.safeNumberN(params, ['stopPrice', 'stop_price', 'triggerPrice']);
|
|
1956
|
+
if (triggerPrice !== undefined) {
|
|
1957
|
+
request['stop_price'] = triggerPrice;
|
|
1959
1958
|
}
|
|
1960
1959
|
const clientOrderId = this.safeString2(params, 'client_order_id', 'clientOrderId');
|
|
1961
1960
|
if (clientOrderId === undefined) {
|
|
@@ -4149,7 +4149,6 @@ class coincatch extends coincatch$1 {
|
|
|
4149
4149
|
'amount': amount,
|
|
4150
4150
|
'filled': this.safeString2(order, 'fillQuantity', 'filledQty'),
|
|
4151
4151
|
'remaining': undefined,
|
|
4152
|
-
'stopPrice': undefined,
|
|
4153
4152
|
'triggerPrice': triggerPrice,
|
|
4154
4153
|
'takeProfitPrice': takeProfitPrice,
|
|
4155
4154
|
'stopLossPrice': stopLossPrice,
|