ccxt 4.1.25 → 4.1.26
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 +197 -2
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bitget.js +196 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/bitget.d.ts +16 -0
- package/js/src/bitget.js +196 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -210,13 +210,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
210
210
|
|
|
211
211
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
212
212
|
|
|
213
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.
|
|
214
|
-
* unpkg: https://unpkg.com/ccxt@4.1.
|
|
213
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.26/dist/ccxt.browser.js
|
|
214
|
+
* unpkg: https://unpkg.com/ccxt@4.1.26/dist/ccxt.browser.js
|
|
215
215
|
|
|
216
216
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
|
217
217
|
|
|
218
218
|
```HTML
|
|
219
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.
|
|
219
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.26/dist/ccxt.browser.js"></script>
|
|
220
220
|
```
|
|
221
221
|
|
|
222
222
|
Creates a global `ccxt` object:
|
package/dist/ccxt.browser.js
CHANGED
|
@@ -38838,7 +38838,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
38838
38838
|
'editOrder': true,
|
|
38839
38839
|
'fetchAccounts': false,
|
|
38840
38840
|
'fetchBalance': true,
|
|
38841
|
-
'fetchBorrowRate':
|
|
38841
|
+
'fetchBorrowRate': true,
|
|
38842
38842
|
'fetchBorrowRateHistories': false,
|
|
38843
38843
|
'fetchBorrowRateHistory': false,
|
|
38844
38844
|
'fetchBorrowRates': false,
|
|
@@ -44977,6 +44977,201 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44977
44977
|
'datetime': this.iso8601(timestamp),
|
|
44978
44978
|
};
|
|
44979
44979
|
}
|
|
44980
|
+
async fetchBorrowRate(code, params = {}) {
|
|
44981
|
+
/**
|
|
44982
|
+
* @method
|
|
44983
|
+
* @name bitget#fetchBorrowRate
|
|
44984
|
+
* @description fetch the rate of interest to borrow a currency for margin trading
|
|
44985
|
+
* @see https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-margin-interest-rate-and-max-borrowable-amount
|
|
44986
|
+
* @see https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-margin-interest-rate-and-borrowable
|
|
44987
|
+
* @param {string} code unified currency code
|
|
44988
|
+
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
44989
|
+
* @param {string} [params.symbol] required for isolated margin
|
|
44990
|
+
* @returns {object} a [borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure}
|
|
44991
|
+
*/
|
|
44992
|
+
await this.loadMarkets();
|
|
44993
|
+
const currency = this.currency(code);
|
|
44994
|
+
let market = undefined;
|
|
44995
|
+
const symbol = this.safeString(params, 'symbol');
|
|
44996
|
+
params = this.omit(params, 'symbol');
|
|
44997
|
+
if (symbol !== undefined) {
|
|
44998
|
+
market = this.market(symbol);
|
|
44999
|
+
}
|
|
45000
|
+
const request = {};
|
|
45001
|
+
let response = undefined;
|
|
45002
|
+
let marginMode = undefined;
|
|
45003
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchBorrowRate', params, 'cross');
|
|
45004
|
+
if ((symbol !== undefined) || (marginMode === 'isolated')) {
|
|
45005
|
+
this.checkRequiredSymbol('fetchBorrowRate', symbol);
|
|
45006
|
+
request['symbol'] = market['info']['symbolName'];
|
|
45007
|
+
response = await this.publicMarginGetIsolatedPublicInterestRateAndLimit(this.extend(request, params));
|
|
45008
|
+
}
|
|
45009
|
+
else if (marginMode === 'cross') {
|
|
45010
|
+
request['coin'] = currency['code'];
|
|
45011
|
+
response = await this.publicMarginGetCrossPublicInterestRateAndLimit(this.extend(request, params));
|
|
45012
|
+
}
|
|
45013
|
+
//
|
|
45014
|
+
// isolated
|
|
45015
|
+
//
|
|
45016
|
+
// {
|
|
45017
|
+
// "code": "00000",
|
|
45018
|
+
// "msg": "success",
|
|
45019
|
+
// "requestTime": 1698208075332,
|
|
45020
|
+
// "data": [
|
|
45021
|
+
// {
|
|
45022
|
+
// "symbol": "BTCUSDT",
|
|
45023
|
+
// "leverage": "10",
|
|
45024
|
+
// "baseCoin": "BTC",
|
|
45025
|
+
// "baseTransferInAble": true,
|
|
45026
|
+
// "baseBorrowAble": true,
|
|
45027
|
+
// "baseDailyInterestRate": "0.00007",
|
|
45028
|
+
// "baseYearlyInterestRate": "0.02555",
|
|
45029
|
+
// "baseMaxBorrowableAmount": "35",
|
|
45030
|
+
// "baseVips": [
|
|
45031
|
+
// {
|
|
45032
|
+
// "level": "0",
|
|
45033
|
+
// "dailyInterestRate": "0.00007",
|
|
45034
|
+
// "yearlyInterestRate": "0.02555",
|
|
45035
|
+
// "discountRate": "1"
|
|
45036
|
+
// },
|
|
45037
|
+
// ],
|
|
45038
|
+
// "quoteCoin": "USDT",
|
|
45039
|
+
// "quoteTransferInAble": true,
|
|
45040
|
+
// "quoteBorrowAble": true,
|
|
45041
|
+
// "quoteDailyInterestRate": "0.00012627",
|
|
45042
|
+
// "quoteYearlyInterestRate": "0.04608855",
|
|
45043
|
+
// "quoteMaxBorrowableAmount": "300000",
|
|
45044
|
+
// "quoteVips": [
|
|
45045
|
+
// {
|
|
45046
|
+
// "level": "0",
|
|
45047
|
+
// "dailyInterestRate": "0.000126279",
|
|
45048
|
+
// "yearlyInterestRate": "0.046091835",
|
|
45049
|
+
// "discountRate": "1"
|
|
45050
|
+
// },
|
|
45051
|
+
// ]
|
|
45052
|
+
// }
|
|
45053
|
+
// ]
|
|
45054
|
+
// }
|
|
45055
|
+
//
|
|
45056
|
+
// cross
|
|
45057
|
+
//
|
|
45058
|
+
// {
|
|
45059
|
+
// "code": "00000",
|
|
45060
|
+
// "msg": "success",
|
|
45061
|
+
// "requestTime": 1698208150986,
|
|
45062
|
+
// "data": [
|
|
45063
|
+
// {
|
|
45064
|
+
// "coin": "BTC",
|
|
45065
|
+
// "leverage": "3",
|
|
45066
|
+
// "transferInAble": true,
|
|
45067
|
+
// "borrowAble": true,
|
|
45068
|
+
// "dailyInterestRate": "0.00007",
|
|
45069
|
+
// "yearlyInterestRate": "0.02555",
|
|
45070
|
+
// "maxBorrowableAmount": "26",
|
|
45071
|
+
// "vips": [
|
|
45072
|
+
// {
|
|
45073
|
+
// "level": "0",
|
|
45074
|
+
// "dailyInterestRate": "0.00007",
|
|
45075
|
+
// "yearlyInterestRate": "0.02555",
|
|
45076
|
+
// "discountRate": "1"
|
|
45077
|
+
// },
|
|
45078
|
+
// ]
|
|
45079
|
+
// }
|
|
45080
|
+
// ]
|
|
45081
|
+
// }
|
|
45082
|
+
//
|
|
45083
|
+
const timestamp = this.safeInteger(response, 'requestTime');
|
|
45084
|
+
const data = this.safeValue(response, 'data', []);
|
|
45085
|
+
const first = this.safeValue(data, 0, {});
|
|
45086
|
+
first['timestamp'] = timestamp;
|
|
45087
|
+
return this.parseBorrowRate(first, currency);
|
|
45088
|
+
}
|
|
45089
|
+
parseBorrowRate(info, currency = undefined) {
|
|
45090
|
+
//
|
|
45091
|
+
// isolated
|
|
45092
|
+
//
|
|
45093
|
+
// {
|
|
45094
|
+
// "symbol": "BTCUSDT",
|
|
45095
|
+
// "leverage": "10",
|
|
45096
|
+
// "baseCoin": "BTC",
|
|
45097
|
+
// "baseTransferInAble": true,
|
|
45098
|
+
// "baseBorrowAble": true,
|
|
45099
|
+
// "baseDailyInterestRate": "0.00007",
|
|
45100
|
+
// "baseYearlyInterestRate": "0.02555",
|
|
45101
|
+
// "baseMaxBorrowableAmount": "35",
|
|
45102
|
+
// "baseVips": [
|
|
45103
|
+
// {
|
|
45104
|
+
// "level": "0",
|
|
45105
|
+
// "dailyInterestRate": "0.00007",
|
|
45106
|
+
// "yearlyInterestRate": "0.02555",
|
|
45107
|
+
// "discountRate": "1"
|
|
45108
|
+
// },
|
|
45109
|
+
// ],
|
|
45110
|
+
// "quoteCoin": "USDT",
|
|
45111
|
+
// "quoteTransferInAble": true,
|
|
45112
|
+
// "quoteBorrowAble": true,
|
|
45113
|
+
// "quoteDailyInterestRate": "0.00012627",
|
|
45114
|
+
// "quoteYearlyInterestRate": "0.04608855",
|
|
45115
|
+
// "quoteMaxBorrowableAmount": "300000",
|
|
45116
|
+
// "quoteVips": [
|
|
45117
|
+
// {
|
|
45118
|
+
// "level": "0",
|
|
45119
|
+
// "dailyInterestRate": "0.000126279",
|
|
45120
|
+
// "yearlyInterestRate": "0.046091835",
|
|
45121
|
+
// "discountRate": "1"
|
|
45122
|
+
// },
|
|
45123
|
+
// ]
|
|
45124
|
+
// }
|
|
45125
|
+
//
|
|
45126
|
+
// cross
|
|
45127
|
+
//
|
|
45128
|
+
// {
|
|
45129
|
+
// "coin": "BTC",
|
|
45130
|
+
// "leverage": "3",
|
|
45131
|
+
// "transferInAble": true,
|
|
45132
|
+
// "borrowAble": true,
|
|
45133
|
+
// "dailyInterestRate": "0.00007",
|
|
45134
|
+
// "yearlyInterestRate": "0.02555",
|
|
45135
|
+
// "maxBorrowableAmount": "26",
|
|
45136
|
+
// "vips": [
|
|
45137
|
+
// {
|
|
45138
|
+
// "level": "0",
|
|
45139
|
+
// "dailyInterestRate": "0.00007",
|
|
45140
|
+
// "yearlyInterestRate": "0.02555",
|
|
45141
|
+
// "discountRate": "1"
|
|
45142
|
+
// },
|
|
45143
|
+
// ]
|
|
45144
|
+
// }
|
|
45145
|
+
//
|
|
45146
|
+
const code = currency['code'];
|
|
45147
|
+
const baseCoin = this.safeString(info, 'baseCoin');
|
|
45148
|
+
const quoteCoin = this.safeString(info, 'quoteCoin');
|
|
45149
|
+
let currencyId = undefined;
|
|
45150
|
+
let interestRate = undefined;
|
|
45151
|
+
if (baseCoin !== undefined) {
|
|
45152
|
+
if (code === baseCoin) {
|
|
45153
|
+
currencyId = baseCoin;
|
|
45154
|
+
interestRate = this.safeNumber(info, 'baseDailyInterestRate');
|
|
45155
|
+
}
|
|
45156
|
+
else if (code === quoteCoin) {
|
|
45157
|
+
currencyId = quoteCoin;
|
|
45158
|
+
interestRate = this.safeNumber(info, 'quoteDailyInterestRate');
|
|
45159
|
+
}
|
|
45160
|
+
}
|
|
45161
|
+
else {
|
|
45162
|
+
currencyId = this.safeString(info, 'coin');
|
|
45163
|
+
interestRate = this.safeNumber(info, 'dailyInterestRate');
|
|
45164
|
+
}
|
|
45165
|
+
const timestamp = this.safeInteger(info, 'timestamp');
|
|
45166
|
+
return {
|
|
45167
|
+
'currency': this.safeCurrencyCode(currencyId, currency),
|
|
45168
|
+
'rate': interestRate,
|
|
45169
|
+
'period': 86400000,
|
|
45170
|
+
'timestamp': timestamp,
|
|
45171
|
+
'datetime': this.iso8601(timestamp),
|
|
45172
|
+
'info': info,
|
|
45173
|
+
};
|
|
45174
|
+
}
|
|
44980
45175
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
44981
45176
|
if (!response) {
|
|
44982
45177
|
return undefined; // fallback to default error handler
|
|
@@ -278718,7 +278913,7 @@ SOFTWARE.
|
|
|
278718
278913
|
|
|
278719
278914
|
//-----------------------------------------------------------------------------
|
|
278720
278915
|
// this is updated by vss.js when building
|
|
278721
|
-
const version = '4.1.
|
|
278916
|
+
const version = '4.1.26';
|
|
278722
278917
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
|
|
278723
278918
|
//-----------------------------------------------------------------------------
|
|
278724
278919
|
|