ccxt 4.4.92 → 4.4.93
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.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +9 -8
- package/dist/cjs/src/base/Exchange.js +67 -11
- package/dist/cjs/src/binance.js +44 -1
- package/dist/cjs/src/bitmex.js +3 -3
- package/dist/cjs/src/bybit.js +83 -8
- package/dist/cjs/src/coinbaseexchange.js +53 -0
- package/dist/cjs/src/coincheck.js +47 -4
- package/dist/cjs/src/coinex.js +19 -14
- package/dist/cjs/src/cryptomus.js +30 -53
- package/dist/cjs/src/deribit.js +6 -6
- package/dist/cjs/src/exmo.js +66 -61
- package/dist/cjs/src/hyperliquid.js +2 -1
- package/dist/cjs/src/kucoin.js +13 -15
- package/dist/cjs/src/latoken.js +19 -74
- package/dist/cjs/src/lbank.js +2 -2
- package/dist/cjs/src/okx.js +156 -0
- package/dist/cjs/src/paradex.js +54 -0
- package/dist/cjs/src/phemex.js +3 -3
- package/dist/cjs/src/pro/bitstamp.js +55 -16
- package/dist/cjs/src/pro/bybit.js +2 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/ascendex.js +9 -8
- package/js/src/base/Exchange.d.ts +3 -1
- package/js/src/base/Exchange.js +67 -11
- package/js/src/binance.d.ts +10 -0
- package/js/src/binance.js +44 -1
- package/js/src/bitmex.d.ts +1 -1
- package/js/src/bitmex.js +3 -3
- package/js/src/bybit.d.ts +12 -1
- package/js/src/bybit.js +83 -8
- package/js/src/coinbaseexchange.js +53 -0
- package/js/src/coincheck.js +48 -5
- package/js/src/coinex.js +16 -13
- package/js/src/cryptomus.js +30 -53
- package/js/src/deribit.js +6 -6
- package/js/src/exmo.js +66 -61
- package/js/src/hyperliquid.js +2 -1
- package/js/src/kucoin.js +13 -15
- package/js/src/latoken.d.ts +0 -1
- package/js/src/latoken.js +19 -74
- package/js/src/lbank.js +2 -2
- package/js/src/okx.d.ts +12 -0
- package/js/src/okx.js +156 -0
- package/js/src/paradex.d.ts +10 -0
- package/js/src/paradex.js +54 -0
- package/js/src/phemex.js +3 -3
- package/js/src/pro/bitstamp.js +55 -16
- package/js/src/pro/bybit.js +2 -1
- package/package.json +1 -1
package/js/src/binance.js
CHANGED
|
@@ -67,6 +67,7 @@ export default class binance extends Exchange {
|
|
|
67
67
|
'editOrder': true,
|
|
68
68
|
'editOrders': true,
|
|
69
69
|
'fetchAccounts': undefined,
|
|
70
|
+
'fetchAllGreeks': true,
|
|
70
71
|
'fetchBalance': true,
|
|
71
72
|
'fetchBidsAsks': true,
|
|
72
73
|
'fetchBorrowInterest': true,
|
|
@@ -11540,6 +11541,7 @@ export default class binance extends Exchange {
|
|
|
11540
11541
|
const request = {};
|
|
11541
11542
|
if (symbol !== undefined) {
|
|
11542
11543
|
request['symbol'] = market['id'];
|
|
11544
|
+
symbol = market['symbol'];
|
|
11543
11545
|
}
|
|
11544
11546
|
if (since !== undefined) {
|
|
11545
11547
|
request['startTime'] = since;
|
|
@@ -11570,7 +11572,7 @@ export default class binance extends Exchange {
|
|
|
11570
11572
|
//
|
|
11571
11573
|
const settlements = this.parseSettlements(response, market);
|
|
11572
11574
|
const sorted = this.sortBy(settlements, 'timestamp');
|
|
11573
|
-
return this.filterBySymbolSinceLimit(sorted,
|
|
11575
|
+
return this.filterBySymbolSinceLimit(sorted, symbol, since, limit);
|
|
11574
11576
|
}
|
|
11575
11577
|
parseSettlement(settlement, market) {
|
|
11576
11578
|
//
|
|
@@ -13335,6 +13337,47 @@ export default class binance extends Exchange {
|
|
|
13335
13337
|
//
|
|
13336
13338
|
return this.parseGreeks(response[0], market);
|
|
13337
13339
|
}
|
|
13340
|
+
/**
|
|
13341
|
+
* @method
|
|
13342
|
+
* @name binance#fetchAllGreeks
|
|
13343
|
+
* @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
13344
|
+
* @see https://developers.binance.com/docs/derivatives/option/market-data/Option-Mark-Price
|
|
13345
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned
|
|
13346
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
13347
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
13348
|
+
*/
|
|
13349
|
+
async fetchAllGreeks(symbols = undefined, params = {}) {
|
|
13350
|
+
await this.loadMarkets();
|
|
13351
|
+
symbols = this.marketSymbols(symbols, undefined, true, true, true);
|
|
13352
|
+
const request = {};
|
|
13353
|
+
let market = undefined;
|
|
13354
|
+
if (symbols !== undefined) {
|
|
13355
|
+
const symbolsLength = symbols.length;
|
|
13356
|
+
if (symbolsLength === 1) {
|
|
13357
|
+
market = this.market(symbols[0]);
|
|
13358
|
+
request['symbol'] = market['id'];
|
|
13359
|
+
}
|
|
13360
|
+
}
|
|
13361
|
+
const response = await this.eapiPublicGetMark(this.extend(request, params));
|
|
13362
|
+
//
|
|
13363
|
+
// [
|
|
13364
|
+
// {
|
|
13365
|
+
// "symbol": "BTC-231229-40000-C",
|
|
13366
|
+
// "markPrice": "2012",
|
|
13367
|
+
// "bidIV": "0.60236275",
|
|
13368
|
+
// "askIV": "0.62267244",
|
|
13369
|
+
// "markIV": "0.6125176",
|
|
13370
|
+
// "delta": "0.39111646",
|
|
13371
|
+
// "theta": "-32.13948531",
|
|
13372
|
+
// "gamma": "0.00004656",
|
|
13373
|
+
// "vega": "51.70062218",
|
|
13374
|
+
// "highPriceLimit": "6474",
|
|
13375
|
+
// "lowPriceLimit": "5"
|
|
13376
|
+
// }
|
|
13377
|
+
// ]
|
|
13378
|
+
//
|
|
13379
|
+
return this.parseAllGreeks(response, symbols);
|
|
13380
|
+
}
|
|
13338
13381
|
parseGreeks(greeks, market = undefined) {
|
|
13339
13382
|
//
|
|
13340
13383
|
// {
|
package/js/src/bitmex.d.ts
CHANGED
|
@@ -206,7 +206,7 @@ export default class bitmex extends Exchange {
|
|
|
206
206
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
207
207
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
208
208
|
* @param {object} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
209
|
-
* @param {object} [params.triggerDirection] the direction whenever the trigger happens with relation to price - '
|
|
209
|
+
* @param {object} [params.triggerDirection] the direction whenever the trigger happens with relation to price - 'ascending' or 'descending'
|
|
210
210
|
* @param {float} [params.trailingAmount] the quote amount to trail away from the current market price
|
|
211
211
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
212
212
|
*/
|
package/js/src/bitmex.js
CHANGED
|
@@ -1990,7 +1990,7 @@ export default class bitmex extends Exchange {
|
|
|
1990
1990
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
1991
1991
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1992
1992
|
* @param {object} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
1993
|
-
* @param {object} [params.triggerDirection] the direction whenever the trigger happens with relation to price - '
|
|
1993
|
+
* @param {object} [params.triggerDirection] the direction whenever the trigger happens with relation to price - 'ascending' or 'descending'
|
|
1994
1994
|
* @param {float} [params.trailingAmount] the quote amount to trail away from the current market price
|
|
1995
1995
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
1996
1996
|
*/
|
|
@@ -2020,7 +2020,7 @@ export default class bitmex extends Exchange {
|
|
|
2020
2020
|
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
2021
2021
|
if (isTriggerOrder || isTrailingAmountOrder) {
|
|
2022
2022
|
const triggerDirection = this.safeString(params, 'triggerDirection');
|
|
2023
|
-
const triggerAbove = (triggerDirection === 'above');
|
|
2023
|
+
const triggerAbove = ((triggerDirection === 'ascending') || (triggerDirection === 'above'));
|
|
2024
2024
|
if ((type === 'limit') || (type === 'market')) {
|
|
2025
2025
|
this.checkRequiredArgument('createOrder', triggerDirection, 'triggerDirection', ['above', 'below']);
|
|
2026
2026
|
}
|
|
@@ -2077,7 +2077,7 @@ export default class bitmex extends Exchange {
|
|
|
2077
2077
|
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
2078
2078
|
if (isTrailingAmountOrder) {
|
|
2079
2079
|
const triggerDirection = this.safeString(params, 'triggerDirection');
|
|
2080
|
-
const triggerAbove = (triggerDirection === 'above');
|
|
2080
|
+
const triggerAbove = ((triggerDirection === 'ascending') || (triggerDirection === 'above'));
|
|
2081
2081
|
if ((type === 'limit') || (type === 'market')) {
|
|
2082
2082
|
this.checkRequiredArgument('createOrder', triggerDirection, 'triggerDirection', ['above', 'below']);
|
|
2083
2083
|
}
|
package/js/src/bybit.d.ts
CHANGED
|
@@ -227,7 +227,7 @@ export default class bybit extends Exchange {
|
|
|
227
227
|
* @param {int} [params.isLeverage] *unified spot only* false then spot trading true then margin trading
|
|
228
228
|
* @param {string} [params.tpslMode] *contract only* 'full' or 'partial'
|
|
229
229
|
* @param {string} [params.mmp] *option only* market maker protection
|
|
230
|
-
* @param {string} [params.triggerDirection] *contract only* the direction for trigger orders, '
|
|
230
|
+
* @param {string} [params.triggerDirection] *contract only* the direction for trigger orders, 'ascending' or 'descending'
|
|
231
231
|
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
232
232
|
* @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
|
|
233
233
|
* @param {float} [params.takeProfitPrice] The price at which a take profit order is triggered at
|
|
@@ -919,6 +919,17 @@ export default class bybit extends Exchange {
|
|
|
919
919
|
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
920
920
|
*/
|
|
921
921
|
fetchGreeks(symbol: string, params?: {}): Promise<Greeks>;
|
|
922
|
+
/**
|
|
923
|
+
* @method
|
|
924
|
+
* @name bybit#fetchAllGreeks
|
|
925
|
+
* @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
926
|
+
* @see https://bybit-exchange.github.io/docs/api-explorer/v5/market/tickers
|
|
927
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned
|
|
928
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
929
|
+
* @param {string} [params.baseCoin] the baseCoin of the symbol, default is BTC
|
|
930
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
931
|
+
*/
|
|
932
|
+
fetchAllGreeks(symbols?: Strings, params?: {}): Promise<Greeks[]>;
|
|
922
933
|
parseGreeks(greeks: Dict, market?: Market): Greeks;
|
|
923
934
|
/**
|
|
924
935
|
* @method
|
package/js/src/bybit.js
CHANGED
|
@@ -60,6 +60,7 @@ export default class bybit extends Exchange {
|
|
|
60
60
|
'createTriggerOrder': true,
|
|
61
61
|
'editOrder': true,
|
|
62
62
|
'editOrders': true,
|
|
63
|
+
'fetchAllGreeks': true,
|
|
63
64
|
'fetchBalance': true,
|
|
64
65
|
'fetchBidsAsks': 'emulated',
|
|
65
66
|
'fetchBorrowInterest': false,
|
|
@@ -1158,6 +1159,7 @@ export default class bybit extends Exchange {
|
|
|
1158
1159
|
'4h': '4h',
|
|
1159
1160
|
'1d': '1d',
|
|
1160
1161
|
},
|
|
1162
|
+
'useMarkPriceForPositionCollateral': false, // use mark price for position collateral
|
|
1161
1163
|
},
|
|
1162
1164
|
'features': {
|
|
1163
1165
|
'default': {
|
|
@@ -3887,7 +3889,7 @@ export default class bybit extends Exchange {
|
|
|
3887
3889
|
* @param {int} [params.isLeverage] *unified spot only* false then spot trading true then margin trading
|
|
3888
3890
|
* @param {string} [params.tpslMode] *contract only* 'full' or 'partial'
|
|
3889
3891
|
* @param {string} [params.mmp] *option only* market maker protection
|
|
3890
|
-
* @param {string} [params.triggerDirection] *contract only* the direction for trigger orders, '
|
|
3892
|
+
* @param {string} [params.triggerDirection] *contract only* the direction for trigger orders, 'ascending' or 'descending'
|
|
3891
3893
|
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
3892
3894
|
* @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
|
|
3893
3895
|
* @param {float} [params.takeProfitPrice] The price at which a take profit order is triggered at
|
|
@@ -4142,9 +4144,9 @@ export default class bybit extends Exchange {
|
|
|
4142
4144
|
}
|
|
4143
4145
|
else {
|
|
4144
4146
|
if (triggerDirection === undefined) {
|
|
4145
|
-
throw new ArgumentsRequired(this.id + ' stop/trigger orders require a triggerDirection parameter, either "
|
|
4147
|
+
throw new ArgumentsRequired(this.id + ' stop/trigger orders require a triggerDirection parameter, either "ascending" or "descending" to determine the direction of the trigger.');
|
|
4146
4148
|
}
|
|
4147
|
-
const isAsending = ((triggerDirection === 'above') || (triggerDirection === '1'));
|
|
4149
|
+
const isAsending = ((triggerDirection === 'ascending') || (triggerDirection === 'above') || (triggerDirection === '1'));
|
|
4148
4150
|
request['triggerDirection'] = isAsending ? 1 : 2;
|
|
4149
4151
|
}
|
|
4150
4152
|
request['triggerPrice'] = this.getPrice(symbol, triggerPrice);
|
|
@@ -6556,12 +6558,14 @@ export default class bybit extends Exchange {
|
|
|
6556
6558
|
}
|
|
6557
6559
|
let collateralString = this.safeString(position, 'positionBalance');
|
|
6558
6560
|
const entryPrice = this.omitZero(this.safeStringN(position, ['entryPrice', 'avgPrice', 'avgEntryPrice']));
|
|
6561
|
+
const markPrice = this.safeString(position, 'markPrice');
|
|
6559
6562
|
const liquidationPrice = this.omitZero(this.safeString(position, 'liqPrice'));
|
|
6560
6563
|
const leverage = this.safeString(position, 'leverage');
|
|
6561
6564
|
if (liquidationPrice !== undefined) {
|
|
6562
6565
|
if (market['settle'] === 'USDC') {
|
|
6563
6566
|
// (Entry price - Liq price) * Contracts + Maintenance Margin + (unrealised pnl) = Collateral
|
|
6564
|
-
const
|
|
6567
|
+
const price = this.safeBool(this.options, 'useMarkPriceForPositionCollateral', false) ? markPrice : entryPrice;
|
|
6568
|
+
const difference = Precise.stringAbs(Precise.stringSub(price, liquidationPrice));
|
|
6565
6569
|
collateralString = Precise.stringAdd(Precise.stringAdd(Precise.stringMul(difference, size), maintenanceMarginString), unrealisedPnl);
|
|
6566
6570
|
}
|
|
6567
6571
|
else {
|
|
@@ -6617,7 +6621,7 @@ export default class bybit extends Exchange {
|
|
|
6617
6621
|
'contractSize': this.safeNumber(market, 'contractSize'),
|
|
6618
6622
|
'marginRatio': this.parseNumber(marginRatio),
|
|
6619
6623
|
'liquidationPrice': this.parseNumber(liquidationPrice),
|
|
6620
|
-
'markPrice': this.
|
|
6624
|
+
'markPrice': this.parseNumber(markPrice),
|
|
6621
6625
|
'lastPrice': this.safeNumber(position, 'avgExitPrice'),
|
|
6622
6626
|
'collateral': this.parseNumber(collateralString),
|
|
6623
6627
|
'marginMode': marginMode,
|
|
@@ -8037,6 +8041,77 @@ export default class bybit extends Exchange {
|
|
|
8037
8041
|
'datetime': this.iso8601(timestamp),
|
|
8038
8042
|
});
|
|
8039
8043
|
}
|
|
8044
|
+
/**
|
|
8045
|
+
* @method
|
|
8046
|
+
* @name bybit#fetchAllGreeks
|
|
8047
|
+
* @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
8048
|
+
* @see https://bybit-exchange.github.io/docs/api-explorer/v5/market/tickers
|
|
8049
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned
|
|
8050
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8051
|
+
* @param {string} [params.baseCoin] the baseCoin of the symbol, default is BTC
|
|
8052
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
8053
|
+
*/
|
|
8054
|
+
async fetchAllGreeks(symbols = undefined, params = {}) {
|
|
8055
|
+
await this.loadMarkets();
|
|
8056
|
+
symbols = this.marketSymbols(symbols, undefined, true, true, true);
|
|
8057
|
+
const baseCoin = this.safeString(params, 'baseCoin', 'BTC');
|
|
8058
|
+
const request = {
|
|
8059
|
+
'category': 'option',
|
|
8060
|
+
'baseCoin': baseCoin,
|
|
8061
|
+
};
|
|
8062
|
+
let market = undefined;
|
|
8063
|
+
if (symbols !== undefined) {
|
|
8064
|
+
const symbolsLength = symbols.length;
|
|
8065
|
+
if (symbolsLength === 1) {
|
|
8066
|
+
market = this.market(symbols[0]);
|
|
8067
|
+
request['symbol'] = market['id'];
|
|
8068
|
+
}
|
|
8069
|
+
}
|
|
8070
|
+
const response = await this.publicGetV5MarketTickers(this.extend(request, params));
|
|
8071
|
+
//
|
|
8072
|
+
// {
|
|
8073
|
+
// "retCode": 0,
|
|
8074
|
+
// "retMsg": "SUCCESS",
|
|
8075
|
+
// "result": {
|
|
8076
|
+
// "category": "option",
|
|
8077
|
+
// "list": [
|
|
8078
|
+
// {
|
|
8079
|
+
// "symbol": "BTC-26JAN24-39000-C",
|
|
8080
|
+
// "bid1Price": "3205",
|
|
8081
|
+
// "bid1Size": "7.1",
|
|
8082
|
+
// "bid1Iv": "0.5478",
|
|
8083
|
+
// "ask1Price": "3315",
|
|
8084
|
+
// "ask1Size": "1.98",
|
|
8085
|
+
// "ask1Iv": "0.5638",
|
|
8086
|
+
// "lastPrice": "3230",
|
|
8087
|
+
// "highPrice24h": "3255",
|
|
8088
|
+
// "lowPrice24h": "3200",
|
|
8089
|
+
// "markPrice": "3273.02263032",
|
|
8090
|
+
// "indexPrice": "36790.96",
|
|
8091
|
+
// "markIv": "0.5577",
|
|
8092
|
+
// "underlyingPrice": "37649.67254894",
|
|
8093
|
+
// "openInterest": "19.67",
|
|
8094
|
+
// "turnover24h": "170140.33875912",
|
|
8095
|
+
// "volume24h": "4.56",
|
|
8096
|
+
// "totalVolume": "22",
|
|
8097
|
+
// "totalTurnover": "789305",
|
|
8098
|
+
// "delta": "0.49640971",
|
|
8099
|
+
// "gamma": "0.00004131",
|
|
8100
|
+
// "vega": "69.08651675",
|
|
8101
|
+
// "theta": "-24.9443226",
|
|
8102
|
+
// "predictedDeliveryPrice": "0",
|
|
8103
|
+
// "change24h": "0.18532111"
|
|
8104
|
+
// }
|
|
8105
|
+
// ]
|
|
8106
|
+
// },
|
|
8107
|
+
// "retExtInfo": {},
|
|
8108
|
+
// "time": 1699584008326
|
|
8109
|
+
// }
|
|
8110
|
+
//
|
|
8111
|
+
const result = this.safeDict(response, 'result', {});
|
|
8112
|
+
const data = this.safeList(result, 'list', []);
|
|
8113
|
+
return this.parseAllGreeks(data, symbols);
|
|
8114
|
+
}
|
|
8040
8115
|
parseGreeks(greeks, market = undefined) {
|
|
8041
8116
|
//
|
|
8042
8117
|
// {
|
|
@@ -9182,7 +9257,7 @@ export default class bybit extends Exchange {
|
|
|
9182
9257
|
}
|
|
9183
9258
|
else {
|
|
9184
9259
|
authFull = auth_base + queryEncoded;
|
|
9185
|
-
url += '?' +
|
|
9260
|
+
url += '?' + queryEncoded;
|
|
9186
9261
|
}
|
|
9187
9262
|
let signature = undefined;
|
|
9188
9263
|
if (this.secret.indexOf('PRIVATE KEY') > -1) {
|
|
@@ -9200,7 +9275,7 @@ export default class bybit extends Exchange {
|
|
|
9200
9275
|
'timestamp': timestamp,
|
|
9201
9276
|
});
|
|
9202
9277
|
const sortedQuery = this.keysort(query);
|
|
9203
|
-
const auth = this.rawencode(sortedQuery);
|
|
9278
|
+
const auth = this.rawencode(sortedQuery, true);
|
|
9204
9279
|
let signature = undefined;
|
|
9205
9280
|
if (this.secret.indexOf('PRIVATE KEY') > -1) {
|
|
9206
9281
|
signature = rsa(auth, this.secret, sha256);
|
|
@@ -9227,7 +9302,7 @@ export default class bybit extends Exchange {
|
|
|
9227
9302
|
}
|
|
9228
9303
|
}
|
|
9229
9304
|
else {
|
|
9230
|
-
url += '?' + this.rawencode(sortedQuery);
|
|
9305
|
+
url += '?' + this.rawencode(sortedQuery, true);
|
|
9231
9306
|
url += '&sign=' + signature;
|
|
9232
9307
|
}
|
|
9233
9308
|
}
|
|
@@ -31,31 +31,73 @@ export default class coinbaseexchange extends Exchange {
|
|
|
31
31
|
'swap': false,
|
|
32
32
|
'future': false,
|
|
33
33
|
'option': false,
|
|
34
|
+
'addMargin': false,
|
|
35
|
+
'borrowCrossMargin': false,
|
|
36
|
+
'borrowIsolatedMargin': false,
|
|
37
|
+
'borrowMargin': false,
|
|
34
38
|
'cancelAllOrders': true,
|
|
35
39
|
'cancelOrder': true,
|
|
40
|
+
'closeAllPositions': false,
|
|
41
|
+
'closePosition': false,
|
|
36
42
|
'createDepositAddress': true,
|
|
37
43
|
'createOrder': true,
|
|
44
|
+
'createOrderWithTakeProfitAndStopLoss': false,
|
|
45
|
+
'createOrderWithTakeProfitAndStopLossWs': false,
|
|
46
|
+
'createPostOnlyOrder': false,
|
|
38
47
|
'createReduceOnlyOrder': false,
|
|
39
48
|
'createStopLimitOrder': true,
|
|
40
49
|
'createStopMarketOrder': true,
|
|
41
50
|
'createStopOrder': true,
|
|
42
51
|
'fetchAccounts': true,
|
|
43
52
|
'fetchBalance': true,
|
|
53
|
+
'fetchBorrowInterest': false,
|
|
54
|
+
'fetchBorrowRate': false,
|
|
55
|
+
'fetchBorrowRateHistories': false,
|
|
56
|
+
'fetchBorrowRateHistory': false,
|
|
57
|
+
'fetchBorrowRates': false,
|
|
58
|
+
'fetchBorrowRatesPerSymbol': false,
|
|
44
59
|
'fetchClosedOrders': true,
|
|
60
|
+
'fetchCrossBorrowRate': false,
|
|
61
|
+
'fetchCrossBorrowRates': false,
|
|
45
62
|
'fetchCurrencies': true,
|
|
46
63
|
'fetchDepositAddress': false,
|
|
47
64
|
'fetchDeposits': true,
|
|
48
65
|
'fetchDepositsWithdrawals': true,
|
|
49
66
|
'fetchFundingHistory': false,
|
|
67
|
+
'fetchFundingInterval': false,
|
|
68
|
+
'fetchFundingIntervals': false,
|
|
50
69
|
'fetchFundingRate': false,
|
|
51
70
|
'fetchFundingRateHistory': false,
|
|
52
71
|
'fetchFundingRates': false,
|
|
72
|
+
'fetchGreeks': false,
|
|
73
|
+
'fetchIndexOHLCV': false,
|
|
74
|
+
'fetchIsolatedBorrowRate': false,
|
|
75
|
+
'fetchIsolatedBorrowRates': false,
|
|
76
|
+
'fetchIsolatedPositions': false,
|
|
53
77
|
'fetchLedger': true,
|
|
78
|
+
'fetchLeverage': false,
|
|
79
|
+
'fetchLeverages': false,
|
|
80
|
+
'fetchLeverageTiers': false,
|
|
81
|
+
'fetchLiquidations': false,
|
|
82
|
+
'fetchLongShortRatio': false,
|
|
83
|
+
'fetchLongShortRatioHistory': false,
|
|
84
|
+
'fetchMarginAdjustmentHistory': false,
|
|
54
85
|
'fetchMarginMode': false,
|
|
86
|
+
'fetchMarginModes': false,
|
|
87
|
+
'fetchMarketLeverageTiers': false,
|
|
55
88
|
'fetchMarkets': true,
|
|
89
|
+
'fetchMarkOHLCV': false,
|
|
90
|
+
'fetchMarkPrices': false,
|
|
91
|
+
'fetchMyLiquidations': false,
|
|
92
|
+
'fetchMySettlementHistory': false,
|
|
56
93
|
'fetchMyTrades': true,
|
|
57
94
|
'fetchOHLCV': true,
|
|
95
|
+
'fetchOpenInterest': false,
|
|
96
|
+
'fetchOpenInterestHistory': false,
|
|
97
|
+
'fetchOpenInterests': false,
|
|
58
98
|
'fetchOpenOrders': true,
|
|
99
|
+
'fetchOption': false,
|
|
100
|
+
'fetchOptionChain': false,
|
|
59
101
|
'fetchOrder': true,
|
|
60
102
|
'fetchOrderBook': true,
|
|
61
103
|
'fetchOrders': true,
|
|
@@ -67,6 +109,8 @@ export default class coinbaseexchange extends Exchange {
|
|
|
67
109
|
'fetchPositionsForSymbol': false,
|
|
68
110
|
'fetchPositionsHistory': false,
|
|
69
111
|
'fetchPositionsRisk': false,
|
|
112
|
+
'fetchPremiumIndexOHLCV': false,
|
|
113
|
+
'fetchSettlementHistory': false,
|
|
70
114
|
'fetchTicker': true,
|
|
71
115
|
'fetchTickers': true,
|
|
72
116
|
'fetchTime': true,
|
|
@@ -74,7 +118,16 @@ export default class coinbaseexchange extends Exchange {
|
|
|
74
118
|
'fetchTradingFee': false,
|
|
75
119
|
'fetchTradingFees': true,
|
|
76
120
|
'fetchTransactions': 'emulated',
|
|
121
|
+
'fetchVolatilityHistory': false,
|
|
77
122
|
'fetchWithdrawals': true,
|
|
123
|
+
'reduceMargin': false,
|
|
124
|
+
'repayCrossMargin': false,
|
|
125
|
+
'repayIsolatedMargin': false,
|
|
126
|
+
'repayMargin': false,
|
|
127
|
+
'setLeverage': false,
|
|
128
|
+
'setMargin': false,
|
|
129
|
+
'setMarginMode': false,
|
|
130
|
+
'setPositionMode': false,
|
|
78
131
|
'withdraw': true,
|
|
79
132
|
},
|
|
80
133
|
'timeframes': {
|
package/js/src/coincheck.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import Exchange from './abstract/coincheck.js';
|
|
9
|
-
import { BadSymbol, ExchangeError, AuthenticationError } from './base/errors.js';
|
|
9
|
+
import { BadSymbol, ExchangeError, AuthenticationError, ArgumentsRequired } from './base/errors.js';
|
|
10
10
|
import { TICK_SIZE } from './base/functions/number.js';
|
|
11
11
|
import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
@@ -29,30 +29,59 @@ export default class coincheck extends Exchange {
|
|
|
29
29
|
'future': false,
|
|
30
30
|
'option': false,
|
|
31
31
|
'addMargin': false,
|
|
32
|
+
'borrowCrossMargin': false,
|
|
33
|
+
'borrowIsolatedMargin': false,
|
|
34
|
+
'borrowMargin': false,
|
|
32
35
|
'cancelOrder': true,
|
|
33
36
|
'closeAllPositions': false,
|
|
34
37
|
'closePosition': false,
|
|
35
38
|
'createOrder': true,
|
|
39
|
+
'createOrderWithTakeProfitAndStopLoss': false,
|
|
40
|
+
'createOrderWithTakeProfitAndStopLossWs': false,
|
|
41
|
+
'createPostOnlyOrder': false,
|
|
36
42
|
'createReduceOnlyOrder': false,
|
|
37
43
|
'fetchBalance': true,
|
|
44
|
+
'fetchBorrowInterest': false,
|
|
45
|
+
'fetchBorrowRate': false,
|
|
38
46
|
'fetchBorrowRateHistories': false,
|
|
39
47
|
'fetchBorrowRateHistory': false,
|
|
48
|
+
'fetchBorrowRates': false,
|
|
49
|
+
'fetchBorrowRatesPerSymbol': false,
|
|
40
50
|
'fetchCrossBorrowRate': false,
|
|
41
51
|
'fetchCrossBorrowRates': false,
|
|
42
52
|
'fetchDeposits': true,
|
|
43
53
|
'fetchFundingHistory': false,
|
|
54
|
+
'fetchFundingInterval': false,
|
|
55
|
+
'fetchFundingIntervals': false,
|
|
44
56
|
'fetchFundingRate': false,
|
|
45
57
|
'fetchFundingRateHistory': false,
|
|
46
58
|
'fetchFundingRates': false,
|
|
59
|
+
'fetchGreeks': false,
|
|
47
60
|
'fetchIndexOHLCV': false,
|
|
48
61
|
'fetchIsolatedBorrowRate': false,
|
|
49
62
|
'fetchIsolatedBorrowRates': false,
|
|
63
|
+
'fetchIsolatedPositions': false,
|
|
50
64
|
'fetchLeverage': false,
|
|
65
|
+
'fetchLeverages': false,
|
|
66
|
+
'fetchLeverageTiers': false,
|
|
67
|
+
'fetchLiquidations': false,
|
|
68
|
+
'fetchLongShortRatio': false,
|
|
69
|
+
'fetchLongShortRatioHistory': false,
|
|
70
|
+
'fetchMarginAdjustmentHistory': false,
|
|
51
71
|
'fetchMarginMode': false,
|
|
72
|
+
'fetchMarginModes': false,
|
|
73
|
+
'fetchMarketLeverageTiers': false,
|
|
52
74
|
'fetchMarkOHLCV': false,
|
|
75
|
+
'fetchMarkPrices': false,
|
|
76
|
+
'fetchMyLiquidations': false,
|
|
77
|
+
'fetchMySettlementHistory': false,
|
|
53
78
|
'fetchMyTrades': true,
|
|
79
|
+
'fetchOpenInterest': false,
|
|
54
80
|
'fetchOpenInterestHistory': false,
|
|
81
|
+
'fetchOpenInterests': false,
|
|
55
82
|
'fetchOpenOrders': true,
|
|
83
|
+
'fetchOption': false,
|
|
84
|
+
'fetchOptionChain': false,
|
|
56
85
|
'fetchOrderBook': true,
|
|
57
86
|
'fetchPosition': false,
|
|
58
87
|
'fetchPositionHistory': false,
|
|
@@ -62,13 +91,19 @@ export default class coincheck extends Exchange {
|
|
|
62
91
|
'fetchPositionsHistory': false,
|
|
63
92
|
'fetchPositionsRisk': false,
|
|
64
93
|
'fetchPremiumIndexOHLCV': false,
|
|
94
|
+
'fetchSettlementHistory': false,
|
|
65
95
|
'fetchTicker': true,
|
|
66
96
|
'fetchTrades': true,
|
|
67
97
|
'fetchTradingFee': false,
|
|
68
98
|
'fetchTradingFees': true,
|
|
99
|
+
'fetchVolatilityHistory': false,
|
|
69
100
|
'fetchWithdrawals': true,
|
|
70
101
|
'reduceMargin': false,
|
|
102
|
+
'repayCrossMargin': false,
|
|
103
|
+
'repayIsolatedMargin': false,
|
|
104
|
+
'repayMargin': false,
|
|
71
105
|
'setLeverage': false,
|
|
106
|
+
'setMargin': false,
|
|
72
107
|
'setMarginMode': false,
|
|
73
108
|
'setPositionMode': false,
|
|
74
109
|
'ws': true,
|
|
@@ -648,10 +683,18 @@ export default class coincheck extends Exchange {
|
|
|
648
683
|
'pair': market['id'],
|
|
649
684
|
};
|
|
650
685
|
if (type === 'market') {
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
686
|
+
request['order_type'] = type + '_' + side;
|
|
687
|
+
if (side === 'sell') {
|
|
688
|
+
request['amount'] = amount;
|
|
689
|
+
}
|
|
690
|
+
else {
|
|
691
|
+
const cost = this.safeNumber(params, 'cost');
|
|
692
|
+
params = this.omit(params, 'cost');
|
|
693
|
+
if (cost !== undefined) {
|
|
694
|
+
throw new ArgumentsRequired(this.id + ' createOrder() : you should use "cost" parameter instead of "amount" argument to create market buy orders');
|
|
695
|
+
}
|
|
696
|
+
request['market_buy_amount'] = cost;
|
|
697
|
+
}
|
|
655
698
|
}
|
|
656
699
|
else {
|
|
657
700
|
request['order_type'] = side;
|
package/js/src/coinex.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import Exchange from './abstract/coinex.js';
|
|
9
|
-
import { ExchangeError, ArgumentsRequired, BadSymbol, InsufficientFunds, OrderNotFound, InvalidOrder, AuthenticationError, PermissionDenied, ExchangeNotAvailable, RequestTimeout, BadRequest, RateLimitExceeded, NotSupported, AccountSuspended } from './base/errors.js';
|
|
9
|
+
import { ExchangeError, ArgumentsRequired, BadSymbol, InsufficientFunds, OrderNotFound, InvalidOrder, AuthenticationError, PermissionDenied, ExchangeNotAvailable, RequestTimeout, BadRequest, RateLimitExceeded, NotSupported, AccountSuspended, OperationFailed } from './base/errors.js';
|
|
10
10
|
import { Precise } from './base/Precise.js';
|
|
11
11
|
import { TICK_SIZE } from './base/functions/number.js';
|
|
12
12
|
import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
|
|
@@ -660,6 +660,7 @@ export default class coinex extends Exchange {
|
|
|
660
660
|
'broad': {
|
|
661
661
|
'ip not allow visit': PermissionDenied,
|
|
662
662
|
'service too busy': ExchangeNotAvailable,
|
|
663
|
+
'Service is not available during funding fee settlement': OperationFailed,
|
|
663
664
|
},
|
|
664
665
|
},
|
|
665
666
|
});
|
|
@@ -787,7 +788,7 @@ export default class coinex extends Exchange {
|
|
|
787
788
|
'max': undefined,
|
|
788
789
|
},
|
|
789
790
|
},
|
|
790
|
-
'networks':
|
|
791
|
+
'networks': networks,
|
|
791
792
|
'type': 'crypto',
|
|
792
793
|
'info': coin,
|
|
793
794
|
});
|
|
@@ -820,17 +821,19 @@ export default class coinex extends Exchange {
|
|
|
820
821
|
// "code": 0,
|
|
821
822
|
// "data": [
|
|
822
823
|
// {
|
|
823
|
-
// "
|
|
824
|
+
// "market": "BTCUSDT",
|
|
825
|
+
// "taker_fee_rate": "0.002",
|
|
826
|
+
// "maker_fee_rate": "0.002",
|
|
827
|
+
// "min_amount": "0.0005",
|
|
828
|
+
// "base_ccy": "BTC",
|
|
829
|
+
// "quote_ccy": "USDT",
|
|
824
830
|
// "base_ccy_precision": 8,
|
|
831
|
+
// "quote_ccy_precision": 2,
|
|
825
832
|
// "is_amm_available": true,
|
|
826
|
-
// "is_margin_available":
|
|
827
|
-
// "
|
|
828
|
-
// "
|
|
829
|
-
//
|
|
830
|
-
// "quote_ccy": "USDT",
|
|
831
|
-
// "quote_ccy_precision": 6,
|
|
832
|
-
// "taker_fee_rate": "0.003"
|
|
833
|
-
// },
|
|
833
|
+
// "is_margin_available": true,
|
|
834
|
+
// "is_pre_trading_available": true,
|
|
835
|
+
// "is_api_trading_available": true
|
|
836
|
+
// }
|
|
834
837
|
// ],
|
|
835
838
|
// "message": "OK"
|
|
836
839
|
// }
|
|
@@ -856,11 +859,11 @@ export default class coinex extends Exchange {
|
|
|
856
859
|
'settleId': undefined,
|
|
857
860
|
'type': 'spot',
|
|
858
861
|
'spot': true,
|
|
859
|
-
'margin':
|
|
862
|
+
'margin': this.safeBool(market, 'is_margin_available'),
|
|
860
863
|
'swap': false,
|
|
861
864
|
'future': false,
|
|
862
865
|
'option': false,
|
|
863
|
-
'active':
|
|
866
|
+
'active': this.safeBool(market, 'is_api_trading_available'),
|
|
864
867
|
'contract': false,
|
|
865
868
|
'linear': undefined,
|
|
866
869
|
'inverse': undefined,
|