ccxt 4.5.11 → 4.5.12
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 +30 -30
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/apex.js +9 -0
- package/dist/cjs/src/base/Exchange.js +1 -1
- package/dist/cjs/src/base/functions/throttle.js +1 -1
- package/dist/cjs/src/binance.js +1 -1
- package/dist/cjs/src/bitget.js +15 -0
- package/dist/cjs/src/bitmart.js +2 -2
- package/dist/cjs/src/bybit.js +28 -7
- package/dist/cjs/src/coincatch.js +2 -1
- package/dist/cjs/src/krakenfutures.js +26 -5
- package/dist/cjs/src/okx.js +18 -9
- package/dist/cjs/src/pro/alpaca.js +17 -1
- package/dist/cjs/src/pro/apex.js +17 -0
- package/dist/cjs/src/pro/binance.js +5 -5
- package/dist/cjs/src/pro/bitget.js +9 -3
- package/dist/cjs/src/pro/coinbase.js +8 -7
- package/dist/cjs/src/pro/hyperliquid.js +4 -0
- package/dist/cjs/src/pro/mexc.js +1 -1
- package/dist/cjs/src/pro/woo.js +48 -4
- package/dist/cjs/src/woo.js +20 -2
- package/dist/cjs/src/xt.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/xt.d.ts +1 -1
- package/js/src/apex.js +9 -0
- package/js/src/base/Exchange.js +1 -1
- package/js/src/base/functions/throttle.js +1 -1
- package/js/src/binance.js +1 -1
- package/js/src/bitget.d.ts +14 -1
- package/js/src/bitget.js +15 -0
- package/js/src/bitmart.js +2 -2
- package/js/src/bybit.js +28 -7
- package/js/src/coincatch.js +2 -1
- package/js/src/krakenfutures.js +26 -5
- package/js/src/okx.js +18 -9
- package/js/src/pro/alpaca.js +17 -1
- package/js/src/pro/apex.d.ts +2 -0
- package/js/src/pro/apex.js +18 -1
- package/js/src/pro/binance.js +5 -5
- package/js/src/pro/bitget.js +9 -3
- package/js/src/pro/coinbase.js +8 -7
- package/js/src/pro/hyperliquid.js +4 -0
- package/js/src/pro/mexc.js +1 -1
- package/js/src/pro/woo.js +48 -4
- package/js/src/woo.js +20 -2
- package/js/src/xt.js +1 -1
- package/package.json +1 -1
package/dist/cjs/src/pro/woo.js
CHANGED
|
@@ -976,8 +976,50 @@ class woo extends woo$1["default"] {
|
|
|
976
976
|
// "reduceOnly": false,
|
|
977
977
|
// "maker": false
|
|
978
978
|
// }
|
|
979
|
+
// {
|
|
980
|
+
// "symbol": "SPOT_BTC_USDT",
|
|
981
|
+
// "rootAlgoOrderId": 2573778,
|
|
982
|
+
// "parentAlgoOrderId": 0,
|
|
983
|
+
// "algoOrderId": 2573778,
|
|
984
|
+
// "clientOrderId": 0,
|
|
985
|
+
// "orderTag": "default",
|
|
986
|
+
// "algoType": "STOP_LOSS",
|
|
987
|
+
// "side": "SELL",
|
|
988
|
+
// "quantity": 0.00011,
|
|
989
|
+
// "triggerPrice": 98566.67,
|
|
990
|
+
// "triggerStatus": "USELESS",
|
|
991
|
+
// "price": 0,
|
|
992
|
+
// "type": "MARKET",
|
|
993
|
+
// "triggerTradePrice": 0,
|
|
994
|
+
// "triggerTime": 0,
|
|
995
|
+
// "tradeId": 0,
|
|
996
|
+
// "executedPrice": 0,
|
|
997
|
+
// "executedQuantity": 0,
|
|
998
|
+
// "fee": 0,
|
|
999
|
+
// "reason": "",
|
|
1000
|
+
// "feeAsset": "",
|
|
1001
|
+
// "totalExecutedQuantity": 0,
|
|
1002
|
+
// "averageExecutedPrice": 0,
|
|
1003
|
+
// "totalFee": 0,
|
|
1004
|
+
// "timestamp": 1761030467426,
|
|
1005
|
+
// "visibleQuantity": 0,
|
|
1006
|
+
// "reduceOnly": false,
|
|
1007
|
+
// "triggerPriceType": "MARKET_PRICE",
|
|
1008
|
+
// "positionSide": "BOTH",
|
|
1009
|
+
// "feeCurrency": "",
|
|
1010
|
+
// "totalRebate": 0.0,
|
|
1011
|
+
// "rebateCurrency": "",
|
|
1012
|
+
// "triggered": false,
|
|
1013
|
+
// "maker": false,
|
|
1014
|
+
// "activated": false,
|
|
1015
|
+
// "isTriggered": false,
|
|
1016
|
+
// "isMaker": false,
|
|
1017
|
+
// "isActivated": false,
|
|
1018
|
+
// "rootAlgoStatus": "NEW",
|
|
1019
|
+
// "algoStatus": "NEW"
|
|
1020
|
+
// }
|
|
979
1021
|
//
|
|
980
|
-
const orderId = this.
|
|
1022
|
+
const orderId = this.safeString2(order, 'orderId', 'algoOrderId');
|
|
981
1023
|
const marketId = this.safeString(order, 'symbol');
|
|
982
1024
|
market = this.market(marketId);
|
|
983
1025
|
const symbol = market['symbol'];
|
|
@@ -1001,10 +1043,11 @@ class woo extends woo$1["default"] {
|
|
|
1001
1043
|
if (amount >= totalExecQuantity) {
|
|
1002
1044
|
remaining -= totalExecQuantity;
|
|
1003
1045
|
}
|
|
1004
|
-
const rawStatus = this.
|
|
1046
|
+
const rawStatus = this.safeString2(order, 'status', 'algoStatus');
|
|
1005
1047
|
const status = this.parseOrderStatus(rawStatus);
|
|
1006
1048
|
const trades = undefined;
|
|
1007
1049
|
const clientOrderId = this.safeString(order, 'clientOrderId');
|
|
1050
|
+
const triggerPrice = this.safeString(order, 'triggerPrice');
|
|
1008
1051
|
return this.safeOrder({
|
|
1009
1052
|
'info': order,
|
|
1010
1053
|
'symbol': symbol,
|
|
@@ -1018,8 +1061,9 @@ class woo extends woo$1["default"] {
|
|
|
1018
1061
|
'postOnly': undefined,
|
|
1019
1062
|
'side': side,
|
|
1020
1063
|
'price': price,
|
|
1021
|
-
'stopPrice':
|
|
1022
|
-
'triggerPrice':
|
|
1064
|
+
'stopPrice': triggerPrice,
|
|
1065
|
+
'triggerPrice': triggerPrice,
|
|
1066
|
+
'reduceOnly': this.safeBool(order, 'reduceOnly'),
|
|
1023
1067
|
'amount': amount,
|
|
1024
1068
|
'cost': undefined,
|
|
1025
1069
|
'average': avgPrice,
|
package/dist/cjs/src/woo.js
CHANGED
|
@@ -1994,7 +1994,16 @@ class woo extends woo$1["default"] {
|
|
|
1994
1994
|
// "positionSide": "BOTH"
|
|
1995
1995
|
// }
|
|
1996
1996
|
//
|
|
1997
|
-
let timestamp =
|
|
1997
|
+
let timestamp = undefined;
|
|
1998
|
+
const timestrampString = this.safeString(order, 'createdTime');
|
|
1999
|
+
if (timestrampString !== undefined) {
|
|
2000
|
+
if (timestrampString.indexOf('.') >= 0) {
|
|
2001
|
+
timestamp = this.safeTimestamp(order, 'createdTime'); // algo orders
|
|
2002
|
+
}
|
|
2003
|
+
else {
|
|
2004
|
+
timestamp = this.safeInteger(order, 'createdTime'); // regular orders
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
1998
2007
|
if (timestamp === undefined) {
|
|
1999
2008
|
timestamp = this.safeInteger(order, 'timestamp');
|
|
2000
2009
|
}
|
|
@@ -2015,7 +2024,16 @@ class woo extends woo$1["default"] {
|
|
|
2015
2024
|
const fee = this.safeNumber(order, 'totalFee');
|
|
2016
2025
|
const feeCurrency = this.safeString(order, 'feeAsset');
|
|
2017
2026
|
const triggerPrice = this.safeNumber(order, 'triggerPrice');
|
|
2018
|
-
const
|
|
2027
|
+
const lastUpdateTimestampString = this.safeString(order, 'updatedTime');
|
|
2028
|
+
let lastUpdateTimestamp = undefined;
|
|
2029
|
+
if (lastUpdateTimestampString !== undefined) {
|
|
2030
|
+
if (lastUpdateTimestampString.indexOf('.') >= 0) {
|
|
2031
|
+
lastUpdateTimestamp = this.safeTimestamp(order, 'updatedTime'); // algo orders
|
|
2032
|
+
}
|
|
2033
|
+
else {
|
|
2034
|
+
lastUpdateTimestamp = this.safeInteger(order, 'updatedTime'); // regular orders
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2019
2037
|
return this.safeOrder({
|
|
2020
2038
|
'id': orderId,
|
|
2021
2039
|
'clientOrderId': clientOrderId,
|
package/dist/cjs/src/xt.js
CHANGED
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 { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, LongShortRatio, OrderBooks, OpenInterests, ConstructorArgs } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.5.
|
|
7
|
+
declare const version = "4.5.11";
|
|
8
8
|
import alpaca from './src/alpaca.js';
|
|
9
9
|
import apex from './src/apex.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, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.5.
|
|
41
|
+
const version = '4.5.11';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import alpaca from './src/alpaca.js';
|
package/js/src/abstract/xt.d.ts
CHANGED
|
@@ -153,7 +153,7 @@ interface Exchange {
|
|
|
153
153
|
privateUserPostUserAccount(params?: {}): Promise<implicitReturnType>;
|
|
154
154
|
privateUserPostUserAccountApiKey(params?: {}): Promise<implicitReturnType>;
|
|
155
155
|
privateUserPutUserAccountApiKey(params?: {}): Promise<implicitReturnType>;
|
|
156
|
-
|
|
156
|
+
privateUserDeleteUserAccountApiKeyId(params?: {}): Promise<implicitReturnType>;
|
|
157
157
|
}
|
|
158
158
|
declare abstract class Exchange extends _Exchange {
|
|
159
159
|
}
|
package/js/src/apex.js
CHANGED
|
@@ -36,6 +36,7 @@ export default class apex extends Exchange {
|
|
|
36
36
|
'addMargin': false,
|
|
37
37
|
'borrowCrossMargin': false,
|
|
38
38
|
'borrowIsolatedMargin': false,
|
|
39
|
+
'borrowMargin': false,
|
|
39
40
|
'cancelAllOrders': true,
|
|
40
41
|
'cancelAllOrdersAfter': false,
|
|
41
42
|
'cancelOrder': true,
|
|
@@ -54,10 +55,14 @@ export default class apex extends Exchange {
|
|
|
54
55
|
'createTriggerOrder': true,
|
|
55
56
|
'editOrder': false,
|
|
56
57
|
'fetchAccounts': true,
|
|
58
|
+
'fetchAllGreeks': false,
|
|
57
59
|
'fetchBalance': true,
|
|
58
60
|
'fetchBorrowInterest': false,
|
|
61
|
+
'fetchBorrowRate': false,
|
|
59
62
|
'fetchBorrowRateHistories': false,
|
|
60
63
|
'fetchBorrowRateHistory': false,
|
|
64
|
+
'fetchBorrowRates': false,
|
|
65
|
+
'fetchBorrowRatesPerSymbol': false,
|
|
61
66
|
'fetchCanceledAndClosedOrders': false,
|
|
62
67
|
'fetchCanceledOrders': false,
|
|
63
68
|
'fetchClosedOrders': false,
|
|
@@ -73,6 +78,7 @@ export default class apex extends Exchange {
|
|
|
73
78
|
'fetchFundingRate': false,
|
|
74
79
|
'fetchFundingRateHistory': true,
|
|
75
80
|
'fetchFundingRates': false,
|
|
81
|
+
'fetchGreeks': false,
|
|
76
82
|
'fetchIndexOHLCV': false,
|
|
77
83
|
'fetchIsolatedBorrowRate': false,
|
|
78
84
|
'fetchIsolatedBorrowRates': false,
|
|
@@ -91,6 +97,8 @@ export default class apex extends Exchange {
|
|
|
91
97
|
'fetchOpenInterestHistory': false,
|
|
92
98
|
'fetchOpenInterests': false,
|
|
93
99
|
'fetchOpenOrders': true,
|
|
100
|
+
'fetchOption': false,
|
|
101
|
+
'fetchOptionChain': false,
|
|
94
102
|
'fetchOrder': true,
|
|
95
103
|
'fetchOrderBook': true,
|
|
96
104
|
'fetchOrders': true,
|
|
@@ -108,6 +116,7 @@ export default class apex extends Exchange {
|
|
|
108
116
|
'fetchTradingFees': false,
|
|
109
117
|
'fetchTransfer': true,
|
|
110
118
|
'fetchTransfers': true,
|
|
119
|
+
'fetchVolatilityHistory': false,
|
|
111
120
|
'fetchWithdrawal': false,
|
|
112
121
|
'fetchWithdrawals': false,
|
|
113
122
|
'reduceMargin': false,
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -2541,7 +2541,7 @@ export default class Exchange {
|
|
|
2541
2541
|
'delay': 0.001,
|
|
2542
2542
|
'capacity': 1,
|
|
2543
2543
|
'cost': 1,
|
|
2544
|
-
'maxCapacity': 1000,
|
|
2544
|
+
'maxCapacity': this.safeInteger(this.options, 'maxRequestsQueue', 1000),
|
|
2545
2545
|
'refillRate': refillRate,
|
|
2546
2546
|
};
|
|
2547
2547
|
const existingBucket = (this.tokenBucket === undefined) ? {} : this.tokenBucket;
|
|
@@ -52,7 +52,7 @@ class Throttler {
|
|
|
52
52
|
resolver = resolve;
|
|
53
53
|
});
|
|
54
54
|
if (this.queue.length > this.config['maxCapacity']) {
|
|
55
|
-
throw new Error('throttle queue is over maxCapacity (' + this.config['maxCapacity'].toString() + '), see https://
|
|
55
|
+
throw new Error('throttle queue is over maxCapacity (' + this.config['maxCapacity'].toString() + '), see https://docs.ccxt.com/#/README?id=maximum-requests-capacity');
|
|
56
56
|
}
|
|
57
57
|
cost = (cost === undefined) ? this.config['cost'] : cost;
|
|
58
58
|
this.queue.push({ resolver, cost });
|
package/js/src/binance.js
CHANGED
|
@@ -247,7 +247,7 @@ export default class binance extends Exchange {
|
|
|
247
247
|
},
|
|
248
248
|
'www': 'https://www.binance.com',
|
|
249
249
|
'referral': {
|
|
250
|
-
'url': 'https://accounts.binance.com/
|
|
250
|
+
'url': 'https://accounts.binance.com/register?ref=CCXTCOM',
|
|
251
251
|
'discount': 0.1,
|
|
252
252
|
},
|
|
253
253
|
'doc': [
|
package/js/src/bitget.d.ts
CHANGED
|
@@ -6,7 +6,20 @@ import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory
|
|
|
6
6
|
*/
|
|
7
7
|
export default class bitget extends Exchange {
|
|
8
8
|
describe(): any;
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @method
|
|
11
|
+
* @name bitget#setSandboxMode
|
|
12
|
+
* @description enables or disables demo trading mode, if enabled will send PAPTRADING=1 in headers
|
|
13
|
+
* @param enabled
|
|
14
|
+
*/
|
|
15
|
+
setSandboxMode(enabled: boolean): void;
|
|
16
|
+
/**
|
|
17
|
+
* @method
|
|
18
|
+
* @name bitget#enableDemoTrading
|
|
19
|
+
* @description enables or disables demo trading mode, if enabled will send PAPTRADING=1 in headers
|
|
20
|
+
* @param enabled
|
|
21
|
+
*/
|
|
22
|
+
enableDemoTrading(enabled: boolean): void;
|
|
10
23
|
handleProductTypeAndParams(market?: any, params?: {}): {}[];
|
|
11
24
|
/**
|
|
12
25
|
* @method
|
package/js/src/bitget.js
CHANGED
|
@@ -1779,9 +1779,24 @@ export default class bitget extends Exchange {
|
|
|
1779
1779
|
},
|
|
1780
1780
|
});
|
|
1781
1781
|
}
|
|
1782
|
+
/**
|
|
1783
|
+
* @method
|
|
1784
|
+
* @name bitget#setSandboxMode
|
|
1785
|
+
* @description enables or disables demo trading mode, if enabled will send PAPTRADING=1 in headers
|
|
1786
|
+
* @param enabled
|
|
1787
|
+
*/
|
|
1782
1788
|
setSandboxMode(enabled) {
|
|
1783
1789
|
this.options['sandboxMode'] = enabled;
|
|
1784
1790
|
}
|
|
1791
|
+
/**
|
|
1792
|
+
* @method
|
|
1793
|
+
* @name bitget#enableDemoTrading
|
|
1794
|
+
* @description enables or disables demo trading mode, if enabled will send PAPTRADING=1 in headers
|
|
1795
|
+
* @param enabled
|
|
1796
|
+
*/
|
|
1797
|
+
enableDemoTrading(enabled) {
|
|
1798
|
+
this.setSandboxMode(enabled);
|
|
1799
|
+
}
|
|
1785
1800
|
handleProductTypeAndParams(market = undefined, params = {}) {
|
|
1786
1801
|
let subType = undefined;
|
|
1787
1802
|
[subType, params] = this.handleSubTypeAndParams('handleProductTypeAndParams', undefined, params);
|
package/js/src/bitmart.js
CHANGED
|
@@ -1014,7 +1014,7 @@ export default class bitmart extends Exchange {
|
|
|
1014
1014
|
'swap': false,
|
|
1015
1015
|
'future': false,
|
|
1016
1016
|
'option': false,
|
|
1017
|
-
'active':
|
|
1017
|
+
'active': this.safeStringLower2(market, 'status', 'trade_status') === 'trading',
|
|
1018
1018
|
'contract': false,
|
|
1019
1019
|
'linear': undefined,
|
|
1020
1020
|
'inverse': undefined,
|
|
@@ -1131,7 +1131,7 @@ export default class bitmart extends Exchange {
|
|
|
1131
1131
|
'swap': isSwap,
|
|
1132
1132
|
'future': isFutures,
|
|
1133
1133
|
'option': false,
|
|
1134
|
-
'active':
|
|
1134
|
+
'active': this.safeStringLower(market, 'status') === 'trading',
|
|
1135
1135
|
'contract': true,
|
|
1136
1136
|
'linear': true,
|
|
1137
1137
|
'inverse': false,
|
package/js/src/bybit.js
CHANGED
|
@@ -185,7 +185,7 @@ export default class bybit extends Exchange {
|
|
|
185
185
|
'https://github.com/bybit-exchange',
|
|
186
186
|
],
|
|
187
187
|
'fees': 'https://help.bybit.com/hc/en-us/articles/360039261154',
|
|
188
|
-
'referral': 'https://www.bybit.com/
|
|
188
|
+
'referral': 'https://www.bybit.com/invite?ref=XDK12WP',
|
|
189
189
|
},
|
|
190
190
|
'api': {
|
|
191
191
|
'public': {
|
|
@@ -4108,7 +4108,7 @@ export default class bybit extends Exchange {
|
|
|
4108
4108
|
if (triggerPrice !== undefined) {
|
|
4109
4109
|
request['orderFilter'] = 'StopOrder';
|
|
4110
4110
|
}
|
|
4111
|
-
else if (
|
|
4111
|
+
else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
|
|
4112
4112
|
request['orderFilter'] = 'tpslOrder';
|
|
4113
4113
|
}
|
|
4114
4114
|
}
|
|
@@ -4131,7 +4131,8 @@ export default class bybit extends Exchange {
|
|
|
4131
4131
|
params = this.omit(params, 'cost');
|
|
4132
4132
|
// if the cost is inferable, let's keep the old logic and ignore marketUnit, to minimize the impact of the changes
|
|
4133
4133
|
const isMarketBuyAndCostInferable = (lowerCaseType === 'market') && (side === 'buy') && ((price !== undefined) || (cost !== undefined));
|
|
4134
|
-
|
|
4134
|
+
const isMarketOrder = lowerCaseType === 'market';
|
|
4135
|
+
if (market['spot'] && isMarketOrder && isUTA && !isMarketBuyAndCostInferable) {
|
|
4135
4136
|
// UTA account can specify the cost of the order on both sides
|
|
4136
4137
|
if ((cost !== undefined) || (price !== undefined)) {
|
|
4137
4138
|
request['marketUnit'] = 'quoteCoin';
|
|
@@ -4150,7 +4151,7 @@ export default class bybit extends Exchange {
|
|
|
4150
4151
|
request['qty'] = amountString;
|
|
4151
4152
|
}
|
|
4152
4153
|
}
|
|
4153
|
-
else if (market['spot'] &&
|
|
4154
|
+
else if (market['spot'] && isMarketOrder && (side === 'buy')) {
|
|
4154
4155
|
// classic accounts
|
|
4155
4156
|
// for market buy it requires the amount of quote currency to spend
|
|
4156
4157
|
let createMarketBuyOrderRequiresPrice = true;
|
|
@@ -4226,6 +4227,16 @@ export default class bybit extends Exchange {
|
|
|
4226
4227
|
request['slOrderType'] = 'Limit';
|
|
4227
4228
|
request['slLimitPrice'] = this.getPrice(symbol, slLimitPrice);
|
|
4228
4229
|
}
|
|
4230
|
+
else {
|
|
4231
|
+
// for spot market, we need to add this
|
|
4232
|
+
if (market['spot']) {
|
|
4233
|
+
request['slOrderType'] = 'Market';
|
|
4234
|
+
}
|
|
4235
|
+
}
|
|
4236
|
+
// for spot market, we need to add this
|
|
4237
|
+
if (market['spot'] && isMarketOrder) {
|
|
4238
|
+
throw new InvalidOrder(this.id + ' createOrder(): attached stopLoss is not supported for spot market orders');
|
|
4239
|
+
}
|
|
4229
4240
|
}
|
|
4230
4241
|
if (isTakeProfit) {
|
|
4231
4242
|
const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
@@ -4236,6 +4247,16 @@ export default class bybit extends Exchange {
|
|
|
4236
4247
|
request['tpOrderType'] = 'Limit';
|
|
4237
4248
|
request['tpLimitPrice'] = this.getPrice(symbol, tpLimitPrice);
|
|
4238
4249
|
}
|
|
4250
|
+
else {
|
|
4251
|
+
// for spot market, we need to add this
|
|
4252
|
+
if (market['spot']) {
|
|
4253
|
+
request['tpOrderType'] = 'Market';
|
|
4254
|
+
}
|
|
4255
|
+
}
|
|
4256
|
+
// for spot market, we need to add this
|
|
4257
|
+
if (market['spot'] && isMarketOrder) {
|
|
4258
|
+
throw new InvalidOrder(this.id + ' createOrder(): attached takeProfit is not supported for spot market orders');
|
|
4259
|
+
}
|
|
4239
4260
|
}
|
|
4240
4261
|
}
|
|
4241
4262
|
if (!market['spot'] && hedged) {
|
|
@@ -6630,7 +6651,7 @@ export default class bybit extends Exchange {
|
|
|
6630
6651
|
}
|
|
6631
6652
|
const notional = this.safeString2(position, 'positionValue', 'cumExitValue');
|
|
6632
6653
|
const unrealisedPnl = this.omitZero(this.safeString(position, 'unrealisedPnl'));
|
|
6633
|
-
let initialMarginString = this.
|
|
6654
|
+
let initialMarginString = this.safeString2(position, 'positionIM', 'cumEntryValue');
|
|
6634
6655
|
let maintenanceMarginString = this.safeString(position, 'positionMM');
|
|
6635
6656
|
const timestamp = this.safeIntegerN(position, ['createdTime', 'createdAt']);
|
|
6636
6657
|
let lastUpdateTimestamp = this.parse8601(this.safeString(position, 'updated_at'));
|
|
@@ -6667,7 +6688,7 @@ export default class bybit extends Exchange {
|
|
|
6667
6688
|
const maintenanceMarginPriceDifference = Precise.stringAbs(Precise.stringSub(liquidationPrice, bustPrice));
|
|
6668
6689
|
maintenanceMarginString = Precise.stringMul(maintenanceMarginPriceDifference, size);
|
|
6669
6690
|
// Initial Margin = Contracts x Entry Price / Leverage
|
|
6670
|
-
if (entryPrice !== undefined) {
|
|
6691
|
+
if ((entryPrice !== undefined) && (initialMarginString === undefined)) {
|
|
6671
6692
|
initialMarginString = Precise.stringDiv(Precise.stringMul(size, entryPrice), leverage);
|
|
6672
6693
|
}
|
|
6673
6694
|
}
|
|
@@ -6680,7 +6701,7 @@ export default class bybit extends Exchange {
|
|
|
6680
6701
|
const multiply = Precise.stringMul(bustPrice, liquidationPrice);
|
|
6681
6702
|
maintenanceMarginString = Precise.stringDiv(Precise.stringMul(size, difference), multiply);
|
|
6682
6703
|
// Initial Margin = Leverage x Contracts / EntryPrice
|
|
6683
|
-
if (entryPrice !== undefined) {
|
|
6704
|
+
if ((entryPrice !== undefined) && (initialMarginString === undefined)) {
|
|
6684
6705
|
initialMarginString = Precise.stringDiv(size, Precise.stringMul(entryPrice, leverage));
|
|
6685
6706
|
}
|
|
6686
6707
|
}
|
package/js/src/coincatch.js
CHANGED
|
@@ -373,7 +373,8 @@ export default class coincatch extends Exchange {
|
|
|
373
373
|
'StratisEVM': 'STRAT',
|
|
374
374
|
'ChilizChain': 'ChilizChain',
|
|
375
375
|
'StellarLumens': 'XLM',
|
|
376
|
-
'CronosChain': 'CRO',
|
|
376
|
+
'CronosChain': 'CRO',
|
|
377
|
+
'Optimism': 'Optimism',
|
|
377
378
|
},
|
|
378
379
|
},
|
|
379
380
|
'features': {
|
package/js/src/krakenfutures.js
CHANGED
|
@@ -1841,6 +1841,22 @@ export default class krakenfutures extends Exchange {
|
|
|
1841
1841
|
// }
|
|
1842
1842
|
// }
|
|
1843
1843
|
//
|
|
1844
|
+
// {
|
|
1845
|
+
// uid: '85805e01-9eed-4395-8360-ed1a228237c9',
|
|
1846
|
+
// accountUid: '406142dd-7c5c-4a8b-acbc-5f16eca30009',
|
|
1847
|
+
// tradeable: 'PF_LTCUSD',
|
|
1848
|
+
// direction: 'Buy',
|
|
1849
|
+
// quantity: '0',
|
|
1850
|
+
// filled: '0.1',
|
|
1851
|
+
// timestamp: '1707258274849',
|
|
1852
|
+
// limitPrice: '69.2200000000',
|
|
1853
|
+
// orderType: 'IoC',
|
|
1854
|
+
// clientId: '',
|
|
1855
|
+
// reduceOnly: false,
|
|
1856
|
+
// lastUpdateTimestamp: '1707258274849',
|
|
1857
|
+
// status: 'closed'
|
|
1858
|
+
// }
|
|
1859
|
+
//
|
|
1844
1860
|
const orderEvents = this.safeValue(order, 'orderEvents', []);
|
|
1845
1861
|
const errorStatus = this.safeString(order, 'status');
|
|
1846
1862
|
const orderEventsLength = orderEvents.length;
|
|
@@ -1962,20 +1978,25 @@ export default class krakenfutures extends Exchange {
|
|
|
1962
1978
|
if (type === 'ioc' || this.parseOrderType(type) === 'market') {
|
|
1963
1979
|
timeInForce = 'ioc';
|
|
1964
1980
|
}
|
|
1981
|
+
let symbol = this.safeString(market, 'symbol');
|
|
1982
|
+
if ('tradeable' in details) {
|
|
1983
|
+
symbol = this.safeSymbol(this.safeString(details, 'tradeable'), market);
|
|
1984
|
+
}
|
|
1985
|
+
const ts = this.safeInteger(details, 'timestamp', timestamp);
|
|
1965
1986
|
return this.safeOrder({
|
|
1966
1987
|
'info': order,
|
|
1967
1988
|
'id': id,
|
|
1968
1989
|
'clientOrderId': this.safeStringN(details, ['clientOrderId', 'clientId', 'cliOrdId']),
|
|
1969
|
-
'timestamp':
|
|
1970
|
-
'datetime': this.iso8601(
|
|
1990
|
+
'timestamp': ts,
|
|
1991
|
+
'datetime': this.iso8601(ts),
|
|
1971
1992
|
'lastTradeTimestamp': undefined,
|
|
1972
|
-
'lastUpdateTimestamp': lastUpdateTimestamp,
|
|
1973
|
-
'symbol':
|
|
1993
|
+
'lastUpdateTimestamp': this.safeInteger(details, 'lastUpdateTimestamp', lastUpdateTimestamp),
|
|
1994
|
+
'symbol': symbol,
|
|
1974
1995
|
'type': this.parseOrderType(type),
|
|
1975
1996
|
'timeInForce': timeInForce,
|
|
1976
1997
|
'postOnly': type === 'post',
|
|
1977
1998
|
'reduceOnly': this.safeBool2(details, 'reduceOnly', 'reduce_only'),
|
|
1978
|
-
'side': this.
|
|
1999
|
+
'side': this.safeStringLower2(details, 'side', 'direction'),
|
|
1979
2000
|
'price': price,
|
|
1980
2001
|
'triggerPrice': this.safeString(details, 'triggerPrice'),
|
|
1981
2002
|
'amount': amount,
|
package/js/src/okx.js
CHANGED
|
@@ -185,7 +185,7 @@ export default class okx extends Exchange {
|
|
|
185
185
|
'referral': {
|
|
186
186
|
// old reflink 0% discount https://www.okx.com/join/1888677
|
|
187
187
|
// new reflink 20% discount https://www.okx.com/join/CCXT2023
|
|
188
|
-
'url': 'https://www.okx.com/join/
|
|
188
|
+
'url': 'https://www.okx.com/join/CCXTCOM',
|
|
189
189
|
'discount': 0.2,
|
|
190
190
|
},
|
|
191
191
|
'test': {
|
|
@@ -1303,7 +1303,8 @@ export default class okx extends Exchange {
|
|
|
1303
1303
|
},
|
|
1304
1304
|
'fetchOHLCV': {
|
|
1305
1305
|
'limit': 300,
|
|
1306
|
-
'
|
|
1306
|
+
'mark': 100,
|
|
1307
|
+
'index': 100,
|
|
1307
1308
|
},
|
|
1308
1309
|
},
|
|
1309
1310
|
'spot': {
|
|
@@ -1329,6 +1330,12 @@ export default class okx extends Exchange {
|
|
|
1329
1330
|
},
|
|
1330
1331
|
},
|
|
1331
1332
|
},
|
|
1333
|
+
'currencies': {
|
|
1334
|
+
'USD': this.safeCurrencyStructure({ 'id': 'USD', 'code': 'USD', 'precision': this.parseNumber('0.0001') }),
|
|
1335
|
+
'EUR': this.safeCurrencyStructure({ 'id': 'EUR', 'code': 'EUR', 'precision': this.parseNumber('0.0001') }),
|
|
1336
|
+
'AED': this.safeCurrencyStructure({ 'id': 'AED', 'code': 'AED', 'precision': this.parseNumber('0.0001') }),
|
|
1337
|
+
'GBP': this.safeCurrencyStructure({ 'id': 'GBP', 'code': 'GBP', 'precision': this.parseNumber('0.0001') }),
|
|
1338
|
+
},
|
|
1332
1339
|
'commonCurrencies': {
|
|
1333
1340
|
// the exchange refers to ERC20 version of Aeternity (AEToken)
|
|
1334
1341
|
'AE': 'AET',
|
|
@@ -2471,16 +2478,18 @@ export default class okx extends Exchange {
|
|
|
2471
2478
|
if (paginate) {
|
|
2472
2479
|
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 200);
|
|
2473
2480
|
}
|
|
2474
|
-
const
|
|
2481
|
+
const priceType = this.safeString(params, 'price');
|
|
2482
|
+
const isMarkOrIndex = this.inArray(priceType, ['mark', 'index']);
|
|
2475
2483
|
params = this.omit(params, 'price');
|
|
2476
2484
|
const options = this.safeDict(this.options, 'fetchOHLCV', {});
|
|
2477
2485
|
const timezone = this.safeString(options, 'timezone', 'UTC');
|
|
2478
2486
|
const limitIsUndefined = (limit === undefined);
|
|
2479
2487
|
if (limit === undefined) {
|
|
2480
|
-
limit = 100; // default 100, max
|
|
2488
|
+
limit = 100; // default 100, max 300
|
|
2481
2489
|
}
|
|
2482
2490
|
else {
|
|
2483
|
-
|
|
2491
|
+
const maxLimit = isMarkOrIndex ? 100 : 300; // default 300, only 100 if 'mark' or 'index'
|
|
2492
|
+
limit = Math.min(limit, maxLimit);
|
|
2484
2493
|
}
|
|
2485
2494
|
const duration = this.parseTimeframe(timeframe);
|
|
2486
2495
|
let bar = this.safeString(this.timeframes, timeframe, timeframe);
|
|
@@ -2500,8 +2509,8 @@ export default class okx extends Exchange {
|
|
|
2500
2509
|
const historyBorder = now - ((1440 - 1) * durationInMilliseconds);
|
|
2501
2510
|
if (since < historyBorder) {
|
|
2502
2511
|
defaultType = 'HistoryCandles';
|
|
2503
|
-
const maxLimit =
|
|
2504
|
-
limit = Math.min(limit, maxLimit);
|
|
2512
|
+
const maxLimit = isMarkOrIndex ? 100 : 300;
|
|
2513
|
+
limit = Math.min(limit, maxLimit);
|
|
2505
2514
|
}
|
|
2506
2515
|
const startTime = Math.max(since - 1, 0);
|
|
2507
2516
|
request['before'] = startTime;
|
|
@@ -2517,7 +2526,7 @@ export default class okx extends Exchange {
|
|
|
2517
2526
|
params = this.omit(params, 'type');
|
|
2518
2527
|
const isHistoryCandles = (type === 'HistoryCandles');
|
|
2519
2528
|
let response = undefined;
|
|
2520
|
-
if (
|
|
2529
|
+
if (priceType === 'mark') {
|
|
2521
2530
|
if (isHistoryCandles) {
|
|
2522
2531
|
response = await this.publicGetMarketHistoryMarkPriceCandles(this.extend(request, params));
|
|
2523
2532
|
}
|
|
@@ -2525,7 +2534,7 @@ export default class okx extends Exchange {
|
|
|
2525
2534
|
response = await this.publicGetMarketMarkPriceCandles(this.extend(request, params));
|
|
2526
2535
|
}
|
|
2527
2536
|
}
|
|
2528
|
-
else if (
|
|
2537
|
+
else if (priceType === 'index') {
|
|
2529
2538
|
request['instId'] = market['info']['instFamily']; // okx index candles require instFamily instead of instId
|
|
2530
2539
|
if (isHistoryCandles) {
|
|
2531
2540
|
response = await this.publicGetMarketHistoryIndexCandles(this.extend(request, params));
|
package/js/src/pro/alpaca.js
CHANGED
|
@@ -14,15 +14,31 @@ export default class alpaca extends alpacaRest {
|
|
|
14
14
|
return this.deepExtend(super.describe(), {
|
|
15
15
|
'has': {
|
|
16
16
|
'ws': true,
|
|
17
|
+
'createOrderWithTakeProfitAndStopLossWs': false,
|
|
18
|
+
'createReduceOnlyOrderWs': false,
|
|
19
|
+
'createStopLossOrderWs': false,
|
|
20
|
+
'createTakeProfitOrderWs': false,
|
|
21
|
+
'fetchPositionForSymbolWs': false,
|
|
22
|
+
'fetchPositionsForSymbolWs': false,
|
|
23
|
+
'fetchPositionsWs': false,
|
|
24
|
+
'fetchPositionWs': false,
|
|
25
|
+
'unWatchPositions': false,
|
|
17
26
|
'watchBalance': false,
|
|
27
|
+
'watchLiquidations': false,
|
|
28
|
+
'watchLiquidationsForSymbols': false,
|
|
29
|
+
'watchMarkPrice': false,
|
|
30
|
+
'watchMarkPrices': false,
|
|
31
|
+
'watchMyLiquidations': false,
|
|
32
|
+
'watchMyLiquidationsForSymbols': false,
|
|
18
33
|
'watchMyTrades': true,
|
|
19
34
|
'watchOHLCV': true,
|
|
20
35
|
'watchOrderBook': true,
|
|
21
36
|
'watchOrders': true,
|
|
37
|
+
'watchPosition': false,
|
|
38
|
+
'watchPositions': false,
|
|
22
39
|
'watchTicker': true,
|
|
23
40
|
'watchTickers': false,
|
|
24
41
|
'watchTrades': true,
|
|
25
|
-
'watchPosition': false,
|
|
26
42
|
},
|
|
27
43
|
'urls': {
|
|
28
44
|
'api': {
|
package/js/src/pro/apex.d.ts
CHANGED
|
@@ -153,7 +153,9 @@ export default class apex extends apexRest {
|
|
|
153
153
|
args: string[];
|
|
154
154
|
op: string;
|
|
155
155
|
};
|
|
156
|
+
pong(client: any, message: any): Promise<void>;
|
|
156
157
|
handlePong(client: Client, message: any): any;
|
|
158
|
+
handlePing(client: Client, message: any): void;
|
|
157
159
|
handleAccount(client: Client, message: any): void;
|
|
158
160
|
handleAuthenticate(client: Client, message: any): any;
|
|
159
161
|
handleSubscriptionStatus(client: Client, message: any): any;
|
package/js/src/pro/apex.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import apexRest from '../apex.js';
|
|
9
9
|
import { ArrayCache, ArrayCacheBySymbolById, ArrayCacheBySymbolBySide, ArrayCacheByTimestamp } from '../base/ws/Cache.js';
|
|
10
|
-
import { ArgumentsRequired, AuthenticationError, ExchangeError } from '../base/errors.js';
|
|
10
|
+
import { ArgumentsRequired, AuthenticationError, ExchangeError, NetworkError } from '../base/errors.js';
|
|
11
11
|
import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
13
13
|
export default class apex extends apexRest {
|
|
@@ -945,6 +945,7 @@ export default class apex extends apexRest {
|
|
|
945
945
|
'recentlyTrade': this.handleTrades,
|
|
946
946
|
'pong': this.handlePong,
|
|
947
947
|
'auth': this.handleAuthenticate,
|
|
948
|
+
'ping': this.handlePing,
|
|
948
949
|
};
|
|
949
950
|
const exacMethod = this.safeValue(methods, topic);
|
|
950
951
|
if (exacMethod !== undefined) {
|
|
@@ -974,6 +975,19 @@ export default class apex extends apexRest {
|
|
|
974
975
|
'op': 'ping',
|
|
975
976
|
};
|
|
976
977
|
}
|
|
978
|
+
async pong(client, message) {
|
|
979
|
+
//
|
|
980
|
+
// {"op": "ping", "args": ["1761069137485"]}
|
|
981
|
+
//
|
|
982
|
+
const timeStamp = this.milliseconds();
|
|
983
|
+
try {
|
|
984
|
+
await client.send({ 'args': [timeStamp.toString()], 'op': 'pong' });
|
|
985
|
+
}
|
|
986
|
+
catch (e) {
|
|
987
|
+
const error = new NetworkError(this.id + ' handlePing failed with error ' + this.json(e));
|
|
988
|
+
client.reset(error);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
977
991
|
handlePong(client, message) {
|
|
978
992
|
//
|
|
979
993
|
// {
|
|
@@ -988,6 +1002,9 @@ export default class apex extends apexRest {
|
|
|
988
1002
|
client.lastPong = this.safeInteger(message, 'pong');
|
|
989
1003
|
return message;
|
|
990
1004
|
}
|
|
1005
|
+
handlePing(client, message) {
|
|
1006
|
+
this.spawn(this.pong, client, message);
|
|
1007
|
+
}
|
|
991
1008
|
handleAccount(client, message) {
|
|
992
1009
|
const contents = this.safeDict(message, 'contents', {});
|
|
993
1010
|
const fills = this.safeList(contents, 'fills', []);
|