ccxt 4.2.21 → 4.2.22
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 +352 -42
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bigone.js +1 -0
- package/dist/cjs/src/binance.js +14 -3
- package/dist/cjs/src/bitget.js +11 -1
- package/dist/cjs/src/bitrue.js +1 -0
- package/dist/cjs/src/bybit.js +57 -9
- package/dist/cjs/src/coinbasepro.js +1 -0
- package/dist/cjs/src/coinex.js +37 -12
- package/dist/cjs/src/deribit.js +164 -0
- package/dist/cjs/src/okcoin.js +3 -0
- package/dist/cjs/src/phemex.js +5 -2
- package/dist/cjs/src/poloniex.js +1 -0
- package/dist/cjs/src/pro/bequant.js +6 -1
- package/dist/cjs/src/pro/binance.js +7 -4
- package/dist/cjs/src/pro/binancecoinm.js +6 -1
- package/dist/cjs/src/pro/binanceus.js +6 -1
- package/dist/cjs/src/pro/bitcoincom.js +6 -1
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bitrue.js +6 -1
- package/dist/cjs/src/pro/okx.js +13 -3
- package/dist/cjs/src/woo.js +1 -1
- package/js/ccxt.d.ts +1 -1
- 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 +4 -0
- package/js/src/abstract/binanceusdm.d.ts +3 -0
- package/js/src/bigone.js +1 -0
- package/js/src/binance.js +14 -3
- package/js/src/bitget.js +11 -1
- package/js/src/bitrue.js +1 -0
- package/js/src/bybit.d.ts +2 -1
- package/js/src/bybit.js +57 -9
- package/js/src/coinbasepro.js +1 -0
- package/js/src/coinex.d.ts +1 -0
- package/js/src/coinex.js +37 -12
- package/js/src/deribit.d.ts +6 -1
- package/js/src/deribit.js +164 -0
- package/js/src/okcoin.js +3 -0
- package/js/src/phemex.js +5 -2
- package/js/src/poloniex.js +1 -0
- package/js/src/pro/bequant.js +6 -1
- package/js/src/pro/binance.js +7 -4
- package/js/src/pro/binancecoinm.js +6 -1
- package/js/src/pro/binanceus.js +6 -1
- package/js/src/pro/bitcoincom.js +6 -1
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bitrue.js +6 -1
- package/js/src/pro/okx.js +13 -3
- package/js/src/woo.js +1 -1
- package/jsdoc2md.js +38 -16
- package/package.json +4 -1
- package/skip-tests.json +4 -0
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var binance = require('./binance.js');
|
|
4
|
+
var binanceus$1 = require('../binanceus.js');
|
|
4
5
|
|
|
5
6
|
// ---------------------------------------------------------------------------
|
|
6
7
|
// ---------------------------------------------------------------------------
|
|
7
8
|
class binanceus extends binance {
|
|
8
9
|
describe() {
|
|
9
|
-
|
|
10
|
+
// eslint-disable-next-line new-cap
|
|
11
|
+
const restInstance = new binanceus$1();
|
|
12
|
+
const restDescribe = restInstance.describe();
|
|
13
|
+
const extended = this.deepExtend(super.describe(), restDescribe);
|
|
14
|
+
return this.deepExtend(extended, {
|
|
10
15
|
'id': 'binanceus',
|
|
11
16
|
'name': 'Binance US',
|
|
12
17
|
'countries': ['US'],
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var hitbtc = require('./hitbtc.js');
|
|
4
|
+
var bequant = require('../bequant.js');
|
|
4
5
|
|
|
5
6
|
// ---------------------------------------------------------------------------
|
|
6
7
|
// ---------------------------------------------------------------------------
|
|
7
8
|
class bitcoincom extends hitbtc {
|
|
8
9
|
describe() {
|
|
9
|
-
|
|
10
|
+
// eslint-disable-next-line new-cap
|
|
11
|
+
const restInstance = new bequant();
|
|
12
|
+
const restDescribe = restInstance.describe();
|
|
13
|
+
const extended = this.deepExtend(super.describe(), restDescribe);
|
|
14
|
+
return this.deepExtend(extended, {
|
|
10
15
|
'id': 'bitcoincom',
|
|
11
16
|
'name': 'bitcoin.com',
|
|
12
17
|
'countries': ['KN'],
|
|
@@ -1245,7 +1245,7 @@ class bitget extends bitget$1 {
|
|
|
1245
1245
|
'price': this.safeString(order, 'price'),
|
|
1246
1246
|
'stopPrice': triggerPrice,
|
|
1247
1247
|
'triggerPrice': triggerPrice,
|
|
1248
|
-
'amount': this.
|
|
1248
|
+
'amount': this.safeString(order, 'baseVolume'),
|
|
1249
1249
|
'cost': this.safeStringN(order, ['notional', 'notionalUsd', 'quoteSize']),
|
|
1250
1250
|
'average': this.omitZero(this.safeString2(order, 'priceAvg', 'fillPrice')),
|
|
1251
1251
|
'filled': this.safeString2(order, 'accBaseVolume', 'baseVolume'),
|
|
@@ -346,7 +346,12 @@ class bitrue extends bitrue$1 {
|
|
|
346
346
|
const symbol = market['symbol'];
|
|
347
347
|
const timestamp = this.safeInteger(message, 'ts');
|
|
348
348
|
const tick = this.safeValue(message, 'tick', {});
|
|
349
|
-
|
|
349
|
+
let orderbook = this.safeValue(this.orderbooks, symbol);
|
|
350
|
+
if (orderbook === undefined) {
|
|
351
|
+
orderbook = this.orderBook();
|
|
352
|
+
}
|
|
353
|
+
const snapshot = this.parseOrderBook(tick, symbol, timestamp, 'buys', 'asks');
|
|
354
|
+
orderbook.reset(snapshot);
|
|
350
355
|
this.orderbooks[symbol] = orderbook;
|
|
351
356
|
const messageHash = 'orderbook:' + symbol;
|
|
352
357
|
client.resolve(orderbook, messageHash);
|
package/dist/cjs/src/pro/okx.js
CHANGED
|
@@ -1011,17 +1011,20 @@ class okx extends okx$1 {
|
|
|
1011
1011
|
/**
|
|
1012
1012
|
* @method
|
|
1013
1013
|
* @name okx#watchOrders
|
|
1014
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
|
|
1015
1014
|
* @description watches information on multiple orders made by the user
|
|
1016
|
-
* @
|
|
1015
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
|
|
1016
|
+
* @param {string} [symbol] unified market symbol of the market the orders were made in
|
|
1017
1017
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
1018
1018
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
1019
1019
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1020
1020
|
* @param {bool} [params.stop] true if fetching trigger or conditional orders
|
|
1021
|
+
* @param {string} [params.type] 'spot', 'swap', 'future', 'option', 'ANY', 'SPOT', 'MARGIN', 'SWAP', 'FUTURES' or 'OPTION'
|
|
1022
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated', for automatically setting the type to spot margin
|
|
1021
1023
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1022
1024
|
*/
|
|
1023
1025
|
let type = undefined;
|
|
1024
1026
|
// By default, receive order updates from any instrument type
|
|
1027
|
+
[type, params] = this.handleOptionAndParams(params, 'watchOrders', 'defaultType');
|
|
1025
1028
|
[type, params] = this.handleOptionAndParams(params, 'watchOrders', 'type', 'ANY');
|
|
1026
1029
|
const isStop = this.safeValue2(params, 'stop', 'trigger', false);
|
|
1027
1030
|
params = this.omit(params, ['stop', 'trigger']);
|
|
@@ -1036,7 +1039,14 @@ class okx extends okx$1 {
|
|
|
1036
1039
|
if (type === 'future') {
|
|
1037
1040
|
type = 'futures';
|
|
1038
1041
|
}
|
|
1039
|
-
|
|
1042
|
+
let uppercaseType = type.toUpperCase();
|
|
1043
|
+
let marginMode = undefined;
|
|
1044
|
+
[marginMode, params] = this.handleMarginModeAndParams('watchOrders', params);
|
|
1045
|
+
if (uppercaseType === 'SPOT') {
|
|
1046
|
+
if (marginMode !== undefined) {
|
|
1047
|
+
uppercaseType = 'MARGIN';
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1040
1050
|
const request = {
|
|
1041
1051
|
'instType': uppercaseType,
|
|
1042
1052
|
};
|
package/dist/cjs/src/woo.js
CHANGED
|
@@ -58,7 +58,7 @@ class woo extends woo$1 {
|
|
|
58
58
|
'fetchClosedOrder': false,
|
|
59
59
|
'fetchClosedOrders': false,
|
|
60
60
|
'fetchCurrencies': true,
|
|
61
|
-
'fetchDepositAddress':
|
|
61
|
+
'fetchDepositAddress': true,
|
|
62
62
|
'fetchDeposits': true,
|
|
63
63
|
'fetchDepositsWithdrawals': true,
|
|
64
64
|
'fetchFundingHistory': true,
|
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 type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } 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, NoChange } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.2.
|
|
7
|
+
declare const version = "4.2.21";
|
|
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, NoChange } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.2.
|
|
41
|
+
const version = '4.2.22';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -93,6 +93,7 @@ interface Exchange {
|
|
|
93
93
|
sapiGetConvertExchangeInfo(params?: {}): Promise<implicitReturnType>;
|
|
94
94
|
sapiGetConvertAssetInfo(params?: {}): Promise<implicitReturnType>;
|
|
95
95
|
sapiGetConvertOrderStatus(params?: {}): Promise<implicitReturnType>;
|
|
96
|
+
sapiGetConvertLimitQueryOpenOrders(params?: {}): Promise<implicitReturnType>;
|
|
96
97
|
sapiGetAccountStatus(params?: {}): Promise<implicitReturnType>;
|
|
97
98
|
sapiGetAccountApiTradingStatus(params?: {}): Promise<implicitReturnType>;
|
|
98
99
|
sapiGetAccountApiRestrictionsIpRestriction(params?: {}): Promise<implicitReturnType>;
|
|
@@ -338,6 +339,8 @@ interface Exchange {
|
|
|
338
339
|
sapiPostLoanVipRepay(params?: {}): Promise<implicitReturnType>;
|
|
339
340
|
sapiPostConvertGetQuote(params?: {}): Promise<implicitReturnType>;
|
|
340
341
|
sapiPostConvertAcceptQuote(params?: {}): Promise<implicitReturnType>;
|
|
342
|
+
sapiPostConvertLimitPlaceOrder(params?: {}): Promise<implicitReturnType>;
|
|
343
|
+
sapiPostConvertLimitCancelOrder(params?: {}): Promise<implicitReturnType>;
|
|
341
344
|
sapiPostPortfolioAutoCollection(params?: {}): Promise<implicitReturnType>;
|
|
342
345
|
sapiPostPortfolioAssetCollection(params?: {}): Promise<implicitReturnType>;
|
|
343
346
|
sapiPostPortfolioBnbTransfer(params?: {}): Promise<implicitReturnType>;
|
|
@@ -93,6 +93,7 @@ interface binance {
|
|
|
93
93
|
sapiGetConvertExchangeInfo(params?: {}): Promise<implicitReturnType>;
|
|
94
94
|
sapiGetConvertAssetInfo(params?: {}): Promise<implicitReturnType>;
|
|
95
95
|
sapiGetConvertOrderStatus(params?: {}): Promise<implicitReturnType>;
|
|
96
|
+
sapiGetConvertLimitQueryOpenOrders(params?: {}): Promise<implicitReturnType>;
|
|
96
97
|
sapiGetAccountStatus(params?: {}): Promise<implicitReturnType>;
|
|
97
98
|
sapiGetAccountApiTradingStatus(params?: {}): Promise<implicitReturnType>;
|
|
98
99
|
sapiGetAccountApiRestrictionsIpRestriction(params?: {}): Promise<implicitReturnType>;
|
|
@@ -338,6 +339,8 @@ interface binance {
|
|
|
338
339
|
sapiPostLoanVipRepay(params?: {}): Promise<implicitReturnType>;
|
|
339
340
|
sapiPostConvertGetQuote(params?: {}): Promise<implicitReturnType>;
|
|
340
341
|
sapiPostConvertAcceptQuote(params?: {}): Promise<implicitReturnType>;
|
|
342
|
+
sapiPostConvertLimitPlaceOrder(params?: {}): Promise<implicitReturnType>;
|
|
343
|
+
sapiPostConvertLimitCancelOrder(params?: {}): Promise<implicitReturnType>;
|
|
341
344
|
sapiPostPortfolioAutoCollection(params?: {}): Promise<implicitReturnType>;
|
|
342
345
|
sapiPostPortfolioAssetCollection(params?: {}): Promise<implicitReturnType>;
|
|
343
346
|
sapiPostPortfolioBnbTransfer(params?: {}): Promise<implicitReturnType>;
|
|
@@ -93,6 +93,7 @@ interface binance {
|
|
|
93
93
|
sapiGetConvertExchangeInfo(params?: {}): Promise<implicitReturnType>;
|
|
94
94
|
sapiGetConvertAssetInfo(params?: {}): Promise<implicitReturnType>;
|
|
95
95
|
sapiGetConvertOrderStatus(params?: {}): Promise<implicitReturnType>;
|
|
96
|
+
sapiGetConvertLimitQueryOpenOrders(params?: {}): Promise<implicitReturnType>;
|
|
96
97
|
sapiGetAccountStatus(params?: {}): Promise<implicitReturnType>;
|
|
97
98
|
sapiGetAccountApiTradingStatus(params?: {}): Promise<implicitReturnType>;
|
|
98
99
|
sapiGetAccountApiRestrictionsIpRestriction(params?: {}): Promise<implicitReturnType>;
|
|
@@ -338,6 +339,8 @@ interface binance {
|
|
|
338
339
|
sapiPostLoanVipRepay(params?: {}): Promise<implicitReturnType>;
|
|
339
340
|
sapiPostConvertGetQuote(params?: {}): Promise<implicitReturnType>;
|
|
340
341
|
sapiPostConvertAcceptQuote(params?: {}): Promise<implicitReturnType>;
|
|
342
|
+
sapiPostConvertLimitPlaceOrder(params?: {}): Promise<implicitReturnType>;
|
|
343
|
+
sapiPostConvertLimitCancelOrder(params?: {}): Promise<implicitReturnType>;
|
|
341
344
|
sapiPostPortfolioAutoCollection(params?: {}): Promise<implicitReturnType>;
|
|
342
345
|
sapiPostPortfolioAssetCollection(params?: {}): Promise<implicitReturnType>;
|
|
343
346
|
sapiPostPortfolioBnbTransfer(params?: {}): Promise<implicitReturnType>;
|
|
@@ -591,6 +594,7 @@ interface binance {
|
|
|
591
594
|
privateGetMyPreventedMatches(params?: {}): Promise<implicitReturnType>;
|
|
592
595
|
privateGetMyAllocations(params?: {}): Promise<implicitReturnType>;
|
|
593
596
|
privateGetAccountCommission(params?: {}): Promise<implicitReturnType>;
|
|
597
|
+
privateGetStatus(params?: {}): Promise<implicitReturnType>;
|
|
594
598
|
privatePostOrderOco(params?: {}): Promise<implicitReturnType>;
|
|
595
599
|
privatePostSorOrder(params?: {}): Promise<implicitReturnType>;
|
|
596
600
|
privatePostSorOrderTest(params?: {}): Promise<implicitReturnType>;
|
|
@@ -93,6 +93,7 @@ interface binance {
|
|
|
93
93
|
sapiGetConvertExchangeInfo(params?: {}): Promise<implicitReturnType>;
|
|
94
94
|
sapiGetConvertAssetInfo(params?: {}): Promise<implicitReturnType>;
|
|
95
95
|
sapiGetConvertOrderStatus(params?: {}): Promise<implicitReturnType>;
|
|
96
|
+
sapiGetConvertLimitQueryOpenOrders(params?: {}): Promise<implicitReturnType>;
|
|
96
97
|
sapiGetAccountStatus(params?: {}): Promise<implicitReturnType>;
|
|
97
98
|
sapiGetAccountApiTradingStatus(params?: {}): Promise<implicitReturnType>;
|
|
98
99
|
sapiGetAccountApiRestrictionsIpRestriction(params?: {}): Promise<implicitReturnType>;
|
|
@@ -338,6 +339,8 @@ interface binance {
|
|
|
338
339
|
sapiPostLoanVipRepay(params?: {}): Promise<implicitReturnType>;
|
|
339
340
|
sapiPostConvertGetQuote(params?: {}): Promise<implicitReturnType>;
|
|
340
341
|
sapiPostConvertAcceptQuote(params?: {}): Promise<implicitReturnType>;
|
|
342
|
+
sapiPostConvertLimitPlaceOrder(params?: {}): Promise<implicitReturnType>;
|
|
343
|
+
sapiPostConvertLimitCancelOrder(params?: {}): Promise<implicitReturnType>;
|
|
341
344
|
sapiPostPortfolioAutoCollection(params?: {}): Promise<implicitReturnType>;
|
|
342
345
|
sapiPostPortfolioAssetCollection(params?: {}): Promise<implicitReturnType>;
|
|
343
346
|
sapiPostPortfolioBnbTransfer(params?: {}): Promise<implicitReturnType>;
|
package/js/src/bigone.js
CHANGED
package/js/src/binance.js
CHANGED
|
@@ -311,6 +311,7 @@ export default class binance extends Exchange {
|
|
|
311
311
|
'convert/exchangeInfo': 50,
|
|
312
312
|
'convert/assetInfo': 10,
|
|
313
313
|
'convert/orderStatus': 0.6667,
|
|
314
|
+
'convert/limit/queryOpenOrders': 20.001,
|
|
314
315
|
'account/status': 0.1,
|
|
315
316
|
'account/apiTradingStatus': 0.1,
|
|
316
317
|
'account/apiRestrictions/ipRestriction': 0.1,
|
|
@@ -582,6 +583,8 @@ export default class binance extends Exchange {
|
|
|
582
583
|
'loan/vip/repay': 40.002,
|
|
583
584
|
'convert/getQuote': 1.3334,
|
|
584
585
|
'convert/acceptQuote': 3.3335,
|
|
586
|
+
'convert/limit/placeOrder': 3.3335,
|
|
587
|
+
'convert/limit/cancelOrder': 1.3334,
|
|
585
588
|
'portfolio/auto-collection': 150,
|
|
586
589
|
'portfolio/asset-collection': 6,
|
|
587
590
|
'portfolio/bnb-transfer': 150,
|
|
@@ -7968,12 +7971,20 @@ export default class binance extends Exchange {
|
|
|
7968
7971
|
/**
|
|
7969
7972
|
* @method
|
|
7970
7973
|
* @name binance#fetchPositions
|
|
7974
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#position-information-v2-user_data
|
|
7975
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#position-information-user_data
|
|
7976
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
|
7977
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
|
|
7978
|
+
* @see https://binance-docs.github.io/apidocs/voptions/en/#option-position-information-user_data
|
|
7971
7979
|
* @description fetch all open positions
|
|
7972
|
-
* @param {string[]
|
|
7980
|
+
* @param {string[]} [symbols] list of unified market symbols
|
|
7973
7981
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7982
|
+
* @param {string} [method] method name to call, "positionRisk", "account" or "option", default is "positionRisk"
|
|
7974
7983
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7975
7984
|
*/
|
|
7976
|
-
const
|
|
7985
|
+
const defaultValue = this.safeString(this.options, 'fetchPositions', 'positionRisk');
|
|
7986
|
+
let defaultMethod = undefined;
|
|
7987
|
+
[defaultMethod, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', defaultValue);
|
|
7977
7988
|
if (defaultMethod === 'positionRisk') {
|
|
7978
7989
|
return await this.fetchPositionsRisk(symbols, params);
|
|
7979
7990
|
}
|
|
@@ -7984,7 +7995,7 @@ export default class binance extends Exchange {
|
|
|
7984
7995
|
return await this.fetchOptionPositions(symbols, params);
|
|
7985
7996
|
}
|
|
7986
7997
|
else {
|
|
7987
|
-
throw new NotSupported(this.id + '.options["fetchPositions"] = "' + defaultMethod + '" is invalid, please choose between "account", "positionRisk" and "option"');
|
|
7998
|
+
throw new NotSupported(this.id + '.options["fetchPositions"]/params["method"] = "' + defaultMethod + '" is invalid, please choose between "account", "positionRisk" and "option"');
|
|
7988
7999
|
}
|
|
7989
8000
|
}
|
|
7990
8001
|
async fetchAccountPositions(symbols = undefined, params = {}) {
|
package/js/src/bitget.js
CHANGED
|
@@ -40,6 +40,7 @@ export default class bitget extends Exchange {
|
|
|
40
40
|
'cancelOrders': true,
|
|
41
41
|
'closeAllPositions': true,
|
|
42
42
|
'closePosition': true,
|
|
43
|
+
'createDepositAddress': false,
|
|
43
44
|
'createMarketBuyOrderWithCost': true,
|
|
44
45
|
'createMarketOrderWithCost': false,
|
|
45
46
|
'createMarketSellOrderWithCost': false,
|
|
@@ -49,8 +50,13 @@ export default class bitget extends Exchange {
|
|
|
49
50
|
'createReduceOnlyOrder': false,
|
|
50
51
|
'createStopLossOrder': true,
|
|
51
52
|
'createTakeProfitOrder': true,
|
|
53
|
+
'createPostOnlyOrder': true,
|
|
54
|
+
'createStopOrder': true,
|
|
55
|
+
'createStopLimitOrder': true,
|
|
56
|
+
'createStopMarketOrder': true,
|
|
52
57
|
'createTrailingPercentOrder': true,
|
|
53
58
|
'createTriggerOrder': true,
|
|
59
|
+
'signIn': false,
|
|
54
60
|
'editOrder': true,
|
|
55
61
|
'fetchAccounts': false,
|
|
56
62
|
'fetchBalance': true,
|
|
@@ -68,7 +74,10 @@ export default class bitget extends Exchange {
|
|
|
68
74
|
'fetchDeposits': true,
|
|
69
75
|
'fetchDepositWithdrawFee': 'emulated',
|
|
70
76
|
'fetchDepositWithdrawFees': true,
|
|
77
|
+
'fetchDepositsWithdrawals': false,
|
|
71
78
|
'fetchFundingHistory': true,
|
|
79
|
+
'fetchWithdrawAddresses': false,
|
|
80
|
+
'fetchTransactions': false,
|
|
72
81
|
'fetchFundingRate': true,
|
|
73
82
|
'fetchFundingRateHistory': true,
|
|
74
83
|
'fetchFundingRates': false,
|
|
@@ -79,7 +88,7 @@ export default class bitget extends Exchange {
|
|
|
79
88
|
'fetchLeverage': true,
|
|
80
89
|
'fetchLeverageTiers': false,
|
|
81
90
|
'fetchLiquidations': false,
|
|
82
|
-
'fetchMarginMode':
|
|
91
|
+
'fetchMarginMode': false,
|
|
83
92
|
'fetchMarketLeverageTiers': true,
|
|
84
93
|
'fetchMarkets': true,
|
|
85
94
|
'fetchMarkOHLCV': true,
|
|
@@ -92,6 +101,7 @@ export default class bitget extends Exchange {
|
|
|
92
101
|
'fetchOrder': true,
|
|
93
102
|
'fetchOrderBook': true,
|
|
94
103
|
'fetchOrders': false,
|
|
104
|
+
'createTrailingAmountOrder': false,
|
|
95
105
|
'fetchOrderTrades': false,
|
|
96
106
|
'fetchPosition': true,
|
|
97
107
|
'fetchPositionMode': false,
|
package/js/src/bitrue.js
CHANGED
|
@@ -55,6 +55,7 @@ export default class bitrue extends Exchange {
|
|
|
55
55
|
'fetchDepositsWithdrawals': false,
|
|
56
56
|
'fetchDepositWithdrawFee': 'emulated',
|
|
57
57
|
'fetchDepositWithdrawFees': true,
|
|
58
|
+
'fetchFundingRate': false,
|
|
58
59
|
'fetchIsolatedBorrowRate': false,
|
|
59
60
|
'fetchIsolatedBorrowRates': false,
|
|
60
61
|
'fetchMarginMode': false,
|
package/js/src/bybit.d.ts
CHANGED
|
@@ -58,8 +58,9 @@ export default class bybit extends Exchange {
|
|
|
58
58
|
parseOrder(order: any, market?: Market): Order;
|
|
59
59
|
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
60
60
|
createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
|
|
61
|
+
createMarketSellOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
|
|
61
62
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
|
|
62
|
-
createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): any;
|
|
63
|
+
createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}, isUTA?: boolean): any;
|
|
63
64
|
createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
|
|
64
65
|
createUsdcOrder(symbol: any, type: any, side: any, amount: any, price?: any, params?: {}): Promise<Order>;
|
|
65
66
|
editUsdcOrder(id: any, symbol: any, type: any, side: any, amount?: any, price?: any, params?: {}): Promise<Order>;
|
package/js/src/bybit.js
CHANGED
|
@@ -41,7 +41,7 @@ export default class bybit extends Exchange {
|
|
|
41
41
|
'closeAllPositions': false,
|
|
42
42
|
'closePosition': false,
|
|
43
43
|
'createMarketBuyOrderWithCost': true,
|
|
44
|
-
'createMarketSellOrderWithCost':
|
|
44
|
+
'createMarketSellOrderWithCost': true,
|
|
45
45
|
'createOrder': true,
|
|
46
46
|
'createOrders': true,
|
|
47
47
|
'createOrderWithTakeProfitAndStopLoss': true,
|
|
@@ -3471,8 +3471,30 @@ export default class bybit extends Exchange {
|
|
|
3471
3471
|
if (!market['spot']) {
|
|
3472
3472
|
throw new NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
3473
3473
|
}
|
|
3474
|
-
|
|
3475
|
-
|
|
3474
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, 1, params);
|
|
3475
|
+
}
|
|
3476
|
+
async createMarketSellOrderWithCost(symbol, cost, params = {}) {
|
|
3477
|
+
/**
|
|
3478
|
+
* @method
|
|
3479
|
+
* @name bybit#createMarkeSellOrderWithCost
|
|
3480
|
+
* @see https://bybit-exchange.github.io/docs/v5/order/create-order
|
|
3481
|
+
* @description create a market sell order by providing the symbol and cost
|
|
3482
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
3483
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
3484
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3485
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3486
|
+
*/
|
|
3487
|
+
await this.loadMarkets();
|
|
3488
|
+
const types = await this.isUnifiedEnabled();
|
|
3489
|
+
const enableUnifiedAccount = types[1];
|
|
3490
|
+
if (!enableUnifiedAccount) {
|
|
3491
|
+
throw new NotSupported(this.id + ' createMarketSellOrderWithCost() supports UTA accounts only');
|
|
3492
|
+
}
|
|
3493
|
+
const market = this.market(symbol);
|
|
3494
|
+
if (!market['spot']) {
|
|
3495
|
+
throw new NotSupported(this.id + ' createMarketSellOrderWithCost() supports spot orders only');
|
|
3496
|
+
}
|
|
3497
|
+
return await this.createOrder(symbol, 'market', 'sell', cost, 1, params);
|
|
3476
3498
|
}
|
|
3477
3499
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
3478
3500
|
/**
|
|
@@ -3516,7 +3538,7 @@ export default class bybit extends Exchange {
|
|
|
3516
3538
|
}
|
|
3517
3539
|
const trailingAmount = this.safeString2(params, 'trailingAmount', 'trailingStop');
|
|
3518
3540
|
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
3519
|
-
const orderRequest = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
3541
|
+
const orderRequest = this.createOrderRequest(symbol, type, side, amount, price, params, enableUnifiedAccount);
|
|
3520
3542
|
let response = undefined;
|
|
3521
3543
|
if (isTrailingAmountOrder) {
|
|
3522
3544
|
response = await this.privatePostV5PositionTradingStop(orderRequest);
|
|
@@ -3539,7 +3561,7 @@ export default class bybit extends Exchange {
|
|
|
3539
3561
|
const order = this.safeValue(response, 'result', {});
|
|
3540
3562
|
return this.parseOrder(order, market);
|
|
3541
3563
|
}
|
|
3542
|
-
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
3564
|
+
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}, isUTA = true) {
|
|
3543
3565
|
const market = this.market(symbol);
|
|
3544
3566
|
symbol = market['symbol'];
|
|
3545
3567
|
const lowerCaseType = type.toLowerCase();
|
|
@@ -3583,12 +3605,36 @@ export default class bybit extends Exchange {
|
|
|
3583
3605
|
else if (market['option']) {
|
|
3584
3606
|
request['category'] = 'option';
|
|
3585
3607
|
}
|
|
3586
|
-
|
|
3608
|
+
const cost = this.safeString(params, 'cost');
|
|
3609
|
+
params = this.omit(params, 'cost');
|
|
3610
|
+
// if the cost is inferable, let's keep the old logic and ignore marketUnit, to minimize the impact of the changes
|
|
3611
|
+
const isMarketBuyAndCostInferable = (lowerCaseType === 'market') && (side === 'buy') && ((price !== undefined) || (cost !== undefined));
|
|
3612
|
+
if (market['spot'] && (type === 'market') && isUTA && !isMarketBuyAndCostInferable) {
|
|
3613
|
+
// UTA account can specify the cost of the order on both sides
|
|
3614
|
+
if ((cost !== undefined) || (price !== undefined)) {
|
|
3615
|
+
request['marketUnit'] = 'quoteCoin';
|
|
3616
|
+
let orderCost = undefined;
|
|
3617
|
+
if (cost !== undefined) {
|
|
3618
|
+
orderCost = cost;
|
|
3619
|
+
}
|
|
3620
|
+
else {
|
|
3621
|
+
const amountString = this.numberToString(amount);
|
|
3622
|
+
const priceString = this.numberToString(price);
|
|
3623
|
+
const quoteAmount = Precise.stringMul(amountString, priceString);
|
|
3624
|
+
orderCost = quoteAmount;
|
|
3625
|
+
}
|
|
3626
|
+
request['qty'] = this.costToPrecision(symbol, orderCost);
|
|
3627
|
+
}
|
|
3628
|
+
else {
|
|
3629
|
+
request['marketUnit'] = 'baseCoin';
|
|
3630
|
+
request['qty'] = this.amountToPrecision(symbol, amount);
|
|
3631
|
+
}
|
|
3632
|
+
}
|
|
3633
|
+
else if (market['spot'] && (type === 'market') && (side === 'buy')) {
|
|
3634
|
+
// classic accounts
|
|
3587
3635
|
// for market buy it requires the amount of quote currency to spend
|
|
3588
3636
|
let createMarketBuyOrderRequiresPrice = true;
|
|
3589
3637
|
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
3590
|
-
const cost = this.safeNumber(params, 'cost');
|
|
3591
|
-
params = this.omit(params, 'cost');
|
|
3592
3638
|
if (createMarketBuyOrderRequiresPrice) {
|
|
3593
3639
|
if ((price === undefined) && (cost === undefined)) {
|
|
3594
3640
|
throw new InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
|
|
@@ -3715,6 +3761,8 @@ export default class bybit extends Exchange {
|
|
|
3715
3761
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3716
3762
|
*/
|
|
3717
3763
|
await this.loadMarkets();
|
|
3764
|
+
const accounts = await this.isUnifiedEnabled();
|
|
3765
|
+
const isUta = accounts[1];
|
|
3718
3766
|
const ordersRequests = [];
|
|
3719
3767
|
const orderSymbols = [];
|
|
3720
3768
|
for (let i = 0; i < orders.length; i++) {
|
|
@@ -3726,7 +3774,7 @@ export default class bybit extends Exchange {
|
|
|
3726
3774
|
const amount = this.safeValue(rawOrder, 'amount');
|
|
3727
3775
|
const price = this.safeValue(rawOrder, 'price');
|
|
3728
3776
|
const orderParams = this.safeValue(rawOrder, 'params', {});
|
|
3729
|
-
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
|
|
3777
|
+
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams, isUta);
|
|
3730
3778
|
ordersRequests.push(orderRequest);
|
|
3731
3779
|
}
|
|
3732
3780
|
const symbols = this.marketSymbols(orderSymbols, undefined, false, true, true);
|
package/js/src/coinbasepro.js
CHANGED
package/js/src/coinex.d.ts
CHANGED
|
@@ -207,6 +207,7 @@ export default class coinex extends Exchange {
|
|
|
207
207
|
};
|
|
208
208
|
fetchDepositWithdrawFees(codes?: Strings, params?: {}): Promise<{}>;
|
|
209
209
|
parseDepositWithdrawFees(response: any, codes?: any, currencyIdKey?: any): {};
|
|
210
|
+
handleMarginModeAndParams(methodName: any, params?: {}, defaultValue?: any): any[];
|
|
210
211
|
nonce(): number;
|
|
211
212
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
212
213
|
url: string;
|
package/js/src/coinex.js
CHANGED
|
@@ -1580,8 +1580,9 @@ export default class coinex extends Exchange {
|
|
|
1580
1580
|
*/
|
|
1581
1581
|
let marketType = undefined;
|
|
1582
1582
|
[marketType, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
1583
|
-
|
|
1584
|
-
|
|
1583
|
+
let marginMode = undefined;
|
|
1584
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchBalance', params);
|
|
1585
|
+
marketType = (marginMode !== undefined) ? 'margin' : marketType;
|
|
1585
1586
|
params = this.omit(params, 'margin');
|
|
1586
1587
|
if (marketType === 'margin') {
|
|
1587
1588
|
return await this.fetchMarginBalance(params);
|
|
@@ -2111,8 +2112,9 @@ export default class coinex extends Exchange {
|
|
|
2111
2112
|
}
|
|
2112
2113
|
}
|
|
2113
2114
|
const accountId = this.safeInteger(params, 'account_id');
|
|
2114
|
-
|
|
2115
|
-
|
|
2115
|
+
let marginMode = undefined;
|
|
2116
|
+
[marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
|
|
2117
|
+
if (marginMode !== undefined) {
|
|
2116
2118
|
if (accountId === undefined) {
|
|
2117
2119
|
throw new BadRequest(this.id + ' createOrder() requires an account_id parameter for margin orders');
|
|
2118
2120
|
}
|
|
@@ -2631,9 +2633,10 @@ export default class coinex extends Exchange {
|
|
|
2631
2633
|
'market': market['id'],
|
|
2632
2634
|
};
|
|
2633
2635
|
const accountId = this.safeInteger(params, 'account_id');
|
|
2634
|
-
|
|
2636
|
+
let marginMode = undefined;
|
|
2637
|
+
[marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
2635
2638
|
const clientOrderId = this.safeString2(params, 'client_id', 'clientOrderId');
|
|
2636
|
-
if (
|
|
2639
|
+
if (marginMode !== undefined) {
|
|
2637
2640
|
if (accountId === undefined) {
|
|
2638
2641
|
throw new BadRequest(this.id + ' cancelOrder() requires an account_id parameter for margin orders');
|
|
2639
2642
|
}
|
|
@@ -3005,8 +3008,9 @@ export default class coinex extends Exchange {
|
|
|
3005
3008
|
}
|
|
3006
3009
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchOrdersByStatus', market, params);
|
|
3007
3010
|
const accountId = this.safeInteger(params, 'account_id');
|
|
3008
|
-
|
|
3009
|
-
|
|
3011
|
+
let marginMode = undefined;
|
|
3012
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchOrdersByStatus', params);
|
|
3013
|
+
if (marginMode !== undefined) {
|
|
3010
3014
|
if (accountId === undefined) {
|
|
3011
3015
|
throw new BadRequest(this.id + ' fetchOpenOrders() and fetchClosedOrders() require an account_id parameter for margin orders');
|
|
3012
3016
|
}
|
|
@@ -3409,8 +3413,9 @@ export default class coinex extends Exchange {
|
|
|
3409
3413
|
}
|
|
3410
3414
|
const swap = (type === 'swap');
|
|
3411
3415
|
const accountId = this.safeInteger(params, 'account_id');
|
|
3412
|
-
|
|
3413
|
-
|
|
3416
|
+
let marginMode = undefined;
|
|
3417
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
|
|
3418
|
+
if (marginMode !== undefined) {
|
|
3414
3419
|
if (accountId === undefined) {
|
|
3415
3420
|
throw new BadRequest(this.id + ' fetchMyTrades() requires an account_id parameter for margin trades');
|
|
3416
3421
|
}
|
|
@@ -4735,9 +4740,10 @@ export default class coinex extends Exchange {
|
|
|
4735
4740
|
request['limit'] = 100;
|
|
4736
4741
|
}
|
|
4737
4742
|
params = this.omit(params, 'page');
|
|
4738
|
-
|
|
4743
|
+
let marginMode = undefined;
|
|
4744
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchTransfers', params);
|
|
4739
4745
|
let response = undefined;
|
|
4740
|
-
if (
|
|
4746
|
+
if (marginMode !== undefined) {
|
|
4741
4747
|
response = await this.privateGetMarginTransferHistory(this.extend(request, params));
|
|
4742
4748
|
}
|
|
4743
4749
|
else {
|
|
@@ -5318,6 +5324,25 @@ export default class coinex extends Exchange {
|
|
|
5318
5324
|
}
|
|
5319
5325
|
return depositWithdrawFees;
|
|
5320
5326
|
}
|
|
5327
|
+
handleMarginModeAndParams(methodName, params = {}, defaultValue = undefined) {
|
|
5328
|
+
/**
|
|
5329
|
+
* @ignore
|
|
5330
|
+
* @method
|
|
5331
|
+
* @description marginMode specified by params["marginMode"], this.options["marginMode"], this.options["defaultMarginMode"], params["margin"] = true or this.options["defaultType"] = 'margin'
|
|
5332
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
5333
|
+
* @returns {Array} the marginMode in lowercase
|
|
5334
|
+
*/
|
|
5335
|
+
const defaultType = this.safeString(this.options, 'defaultType');
|
|
5336
|
+
const isMargin = this.safeValue(params, 'margin', false);
|
|
5337
|
+
let marginMode = undefined;
|
|
5338
|
+
[marginMode, params] = super.handleMarginModeAndParams(methodName, params, defaultValue);
|
|
5339
|
+
if (marginMode === undefined) {
|
|
5340
|
+
if ((defaultType === 'margin') || (isMargin === true)) {
|
|
5341
|
+
marginMode = 'isolated';
|
|
5342
|
+
}
|
|
5343
|
+
}
|
|
5344
|
+
return [marginMode, params];
|
|
5345
|
+
}
|
|
5321
5346
|
nonce() {
|
|
5322
5347
|
return this.milliseconds();
|
|
5323
5348
|
}
|
package/js/src/deribit.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
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 } 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, MarketInterface } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class deribit
|
|
5
5
|
* @augments Exchange
|
|
6
6
|
*/
|
|
7
7
|
export default class deribit extends Exchange {
|
|
8
8
|
describe(): any;
|
|
9
|
+
convertExpireDate(date: any): string;
|
|
10
|
+
convertMarketIdExpireDate(date: any): string;
|
|
11
|
+
convertExpireDateToMarketIdDate(date: any): any;
|
|
12
|
+
createExpiredOptionMarket(symbol: any): MarketInterface;
|
|
13
|
+
safeMarket(marketId?: any, market?: any, delimiter?: any, marketType?: any): MarketInterface;
|
|
9
14
|
fetchTime(params?: {}): Promise<number>;
|
|
10
15
|
fetchCurrencies(params?: {}): Promise<{}>;
|
|
11
16
|
codeFromOptions(methodName: any, params?: {}): any;
|