ccxt 4.0.94 → 4.0.95
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 +58 -1
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bitmart.js +57 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/bitmart.d.ts +16 -0
- package/js/src/bitmart.js +57 -0
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -180,7 +180,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
180
180
|
|
|
181
181
|
//-----------------------------------------------------------------------------
|
|
182
182
|
// this is updated by vss.js when building
|
|
183
|
-
const version = '4.0.
|
|
183
|
+
const version = '4.0.95';
|
|
184
184
|
Exchange["default"].ccxtVersion = version;
|
|
185
185
|
const exchanges = {
|
|
186
186
|
'ace': ace,
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -61,6 +61,8 @@ class bitmart extends bitmart$1 {
|
|
|
61
61
|
'fetchMarkets': true,
|
|
62
62
|
'fetchMyTrades': true,
|
|
63
63
|
'fetchOHLCV': true,
|
|
64
|
+
'fetchOpenInterest': true,
|
|
65
|
+
'fetchOpenInterestHistory': false,
|
|
64
66
|
'fetchOpenOrders': true,
|
|
65
67
|
'fetchOrder': true,
|
|
66
68
|
'fetchOrderBook': true,
|
|
@@ -3147,6 +3149,61 @@ class bitmart extends bitmart$1 {
|
|
|
3147
3149
|
'info': info,
|
|
3148
3150
|
};
|
|
3149
3151
|
}
|
|
3152
|
+
async fetchOpenInterest(symbol, params = {}) {
|
|
3153
|
+
/**
|
|
3154
|
+
* @method
|
|
3155
|
+
* @name bitmart#fetchOpenInterest
|
|
3156
|
+
* @description Retrieves the open interest of a currency
|
|
3157
|
+
* @see https://developer-pro.bitmart.com/en/futures/#get-futures-openinterest
|
|
3158
|
+
* @param {string} symbol Unified CCXT market symbol
|
|
3159
|
+
* @param {object} [params] exchange specific parameters
|
|
3160
|
+
* @returns {object} an open interest structure{@link https://github.com/ccxt/ccxt/wiki/Manual#interest-history-structure}
|
|
3161
|
+
*/
|
|
3162
|
+
await this.loadMarkets();
|
|
3163
|
+
const market = this.market(symbol);
|
|
3164
|
+
if (!market['contract']) {
|
|
3165
|
+
throw new errors.BadRequest(this.id + ' fetchOpenInterest() supports contract markets only');
|
|
3166
|
+
}
|
|
3167
|
+
const request = {
|
|
3168
|
+
'symbol': market['id'],
|
|
3169
|
+
};
|
|
3170
|
+
const response = await this.publicGetContractPublicOpenInterest(this.extend(request, params));
|
|
3171
|
+
//
|
|
3172
|
+
// {
|
|
3173
|
+
// "code": 1000,
|
|
3174
|
+
// "message": "Ok",
|
|
3175
|
+
// "data": {
|
|
3176
|
+
// "timestamp": 1694657502415,
|
|
3177
|
+
// "symbol": "BTCUSDT",
|
|
3178
|
+
// "open_interest": "265231.721368593081729069",
|
|
3179
|
+
// "open_interest_value": "7006353.83988919"
|
|
3180
|
+
// },
|
|
3181
|
+
// "trace": "7f9c94e10f9d4513bc08a7bfc2a5559a.72.16946575108274991"
|
|
3182
|
+
// }
|
|
3183
|
+
//
|
|
3184
|
+
const data = this.safeValue(response, 'data', {});
|
|
3185
|
+
return this.parseOpenInterest(data, market);
|
|
3186
|
+
}
|
|
3187
|
+
parseOpenInterest(interest, market = undefined) {
|
|
3188
|
+
//
|
|
3189
|
+
// {
|
|
3190
|
+
// "timestamp": 1694657502415,
|
|
3191
|
+
// "symbol": "BTCUSDT",
|
|
3192
|
+
// "open_interest": "265231.721368593081729069",
|
|
3193
|
+
// "open_interest_value": "7006353.83988919"
|
|
3194
|
+
// }
|
|
3195
|
+
//
|
|
3196
|
+
const timestamp = this.safeInteger(interest, 'timestamp');
|
|
3197
|
+
const id = this.safeString(interest, 'symbol');
|
|
3198
|
+
return {
|
|
3199
|
+
'symbol': this.safeSymbol(id, market),
|
|
3200
|
+
'openInterestAmount': this.safeNumber(interest, 'open_interest'),
|
|
3201
|
+
'openInterestValue': this.safeNumber(interest, 'open_interest_value'),
|
|
3202
|
+
'timestamp': timestamp,
|
|
3203
|
+
'datetime': this.iso8601(timestamp),
|
|
3204
|
+
'info': interest,
|
|
3205
|
+
};
|
|
3206
|
+
}
|
|
3150
3207
|
handleMarginModeAndParams(methodName, params = {}, defaultValue = undefined) {
|
|
3151
3208
|
/**
|
|
3152
3209
|
* @ignore
|
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 } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.0.
|
|
7
|
+
declare const version = "4.0.94";
|
|
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 } 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.95';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
package/js/src/bitmart.d.ts
CHANGED
|
@@ -208,6 +208,22 @@ export default class bitmart extends Exchange {
|
|
|
208
208
|
datetime: string;
|
|
209
209
|
info: any;
|
|
210
210
|
};
|
|
211
|
+
fetchOpenInterest(symbol: string, params?: {}): Promise<{
|
|
212
|
+
symbol: any;
|
|
213
|
+
openInterestAmount: number;
|
|
214
|
+
openInterestValue: number;
|
|
215
|
+
timestamp: number;
|
|
216
|
+
datetime: string;
|
|
217
|
+
info: any;
|
|
218
|
+
}>;
|
|
219
|
+
parseOpenInterest(interest: any, market?: any): {
|
|
220
|
+
symbol: any;
|
|
221
|
+
openInterestAmount: number;
|
|
222
|
+
openInterestValue: number;
|
|
223
|
+
timestamp: number;
|
|
224
|
+
datetime: string;
|
|
225
|
+
info: any;
|
|
226
|
+
};
|
|
211
227
|
handleMarginModeAndParams(methodName: any, params?: {}, defaultValue?: any): any[];
|
|
212
228
|
nonce(): number;
|
|
213
229
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
package/js/src/bitmart.js
CHANGED
|
@@ -64,6 +64,8 @@ export default class bitmart extends Exchange {
|
|
|
64
64
|
'fetchMarkets': true,
|
|
65
65
|
'fetchMyTrades': true,
|
|
66
66
|
'fetchOHLCV': true,
|
|
67
|
+
'fetchOpenInterest': true,
|
|
68
|
+
'fetchOpenInterestHistory': false,
|
|
67
69
|
'fetchOpenOrders': true,
|
|
68
70
|
'fetchOrder': true,
|
|
69
71
|
'fetchOrderBook': true,
|
|
@@ -3150,6 +3152,61 @@ export default class bitmart extends Exchange {
|
|
|
3150
3152
|
'info': info,
|
|
3151
3153
|
};
|
|
3152
3154
|
}
|
|
3155
|
+
async fetchOpenInterest(symbol, params = {}) {
|
|
3156
|
+
/**
|
|
3157
|
+
* @method
|
|
3158
|
+
* @name bitmart#fetchOpenInterest
|
|
3159
|
+
* @description Retrieves the open interest of a currency
|
|
3160
|
+
* @see https://developer-pro.bitmart.com/en/futures/#get-futures-openinterest
|
|
3161
|
+
* @param {string} symbol Unified CCXT market symbol
|
|
3162
|
+
* @param {object} [params] exchange specific parameters
|
|
3163
|
+
* @returns {object} an open interest structure{@link https://github.com/ccxt/ccxt/wiki/Manual#interest-history-structure}
|
|
3164
|
+
*/
|
|
3165
|
+
await this.loadMarkets();
|
|
3166
|
+
const market = this.market(symbol);
|
|
3167
|
+
if (!market['contract']) {
|
|
3168
|
+
throw new BadRequest(this.id + ' fetchOpenInterest() supports contract markets only');
|
|
3169
|
+
}
|
|
3170
|
+
const request = {
|
|
3171
|
+
'symbol': market['id'],
|
|
3172
|
+
};
|
|
3173
|
+
const response = await this.publicGetContractPublicOpenInterest(this.extend(request, params));
|
|
3174
|
+
//
|
|
3175
|
+
// {
|
|
3176
|
+
// "code": 1000,
|
|
3177
|
+
// "message": "Ok",
|
|
3178
|
+
// "data": {
|
|
3179
|
+
// "timestamp": 1694657502415,
|
|
3180
|
+
// "symbol": "BTCUSDT",
|
|
3181
|
+
// "open_interest": "265231.721368593081729069",
|
|
3182
|
+
// "open_interest_value": "7006353.83988919"
|
|
3183
|
+
// },
|
|
3184
|
+
// "trace": "7f9c94e10f9d4513bc08a7bfc2a5559a.72.16946575108274991"
|
|
3185
|
+
// }
|
|
3186
|
+
//
|
|
3187
|
+
const data = this.safeValue(response, 'data', {});
|
|
3188
|
+
return this.parseOpenInterest(data, market);
|
|
3189
|
+
}
|
|
3190
|
+
parseOpenInterest(interest, market = undefined) {
|
|
3191
|
+
//
|
|
3192
|
+
// {
|
|
3193
|
+
// "timestamp": 1694657502415,
|
|
3194
|
+
// "symbol": "BTCUSDT",
|
|
3195
|
+
// "open_interest": "265231.721368593081729069",
|
|
3196
|
+
// "open_interest_value": "7006353.83988919"
|
|
3197
|
+
// }
|
|
3198
|
+
//
|
|
3199
|
+
const timestamp = this.safeInteger(interest, 'timestamp');
|
|
3200
|
+
const id = this.safeString(interest, 'symbol');
|
|
3201
|
+
return {
|
|
3202
|
+
'symbol': this.safeSymbol(id, market),
|
|
3203
|
+
'openInterestAmount': this.safeNumber(interest, 'open_interest'),
|
|
3204
|
+
'openInterestValue': this.safeNumber(interest, 'open_interest_value'),
|
|
3205
|
+
'timestamp': timestamp,
|
|
3206
|
+
'datetime': this.iso8601(timestamp),
|
|
3207
|
+
'info': interest,
|
|
3208
|
+
};
|
|
3209
|
+
}
|
|
3153
3210
|
handleMarginModeAndParams(methodName, params = {}, defaultValue = undefined) {
|
|
3154
3211
|
/**
|
|
3155
3212
|
* @ignore
|
package/package.json
CHANGED