ccxt 4.5.31 → 4.5.32
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 +6 -5
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +6 -1
- package/dist/cjs/src/abstract/aster.js +11 -0
- package/dist/cjs/src/aster.js +3802 -0
- package/dist/cjs/src/backpack.js +1 -1
- package/dist/cjs/src/base/Exchange.js +19 -1
- package/dist/cjs/src/bigone.js +1 -1
- package/dist/cjs/src/binance.js +1 -0
- package/dist/cjs/src/bingx.js +73 -0
- package/dist/cjs/src/cryptomus.js +1 -1
- package/dist/cjs/src/okx.js +14 -5
- package/dist/cjs/src/pro/aster.js +1046 -0
- package/dist/cjs/src/pro/dydx.js +1 -1
- package/js/ccxt.d.ts +8 -2
- package/js/ccxt.js +6 -2
- package/js/src/abstract/aster.d.ts +88 -0
- package/js/src/abstract/aster.js +11 -0
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/aster.d.ts +563 -0
- package/js/src/aster.js +3801 -0
- package/js/src/backpack.js +1 -1
- package/js/src/base/Exchange.d.ts +1 -0
- package/js/src/base/Exchange.js +19 -0
- package/js/src/bigone.js +1 -1
- package/js/src/binance.js +1 -0
- package/js/src/bingx.d.ts +12 -1
- package/js/src/bingx.js +73 -0
- package/js/src/cryptomus.js +1 -1
- package/js/src/okx.js +14 -5
- package/js/src/pro/aster.d.ts +273 -0
- package/js/src/pro/aster.js +1045 -0
- package/js/src/pro/dydx.js +1 -1
- package/package.json +1 -1
package/dist/cjs/src/backpack.js
CHANGED
|
@@ -521,7 +521,7 @@ class backpack extends backpack$1["default"] {
|
|
|
521
521
|
// "depositEnabled": true,
|
|
522
522
|
// "displayName": "Jito",
|
|
523
523
|
// "maximumWithdrawal": null,
|
|
524
|
-
// "minimumDeposit": "0.
|
|
524
|
+
// "minimumDeposit": "0.28",
|
|
525
525
|
// "minimumWithdrawal": "0.58",
|
|
526
526
|
// "withdrawEnabled": true,
|
|
527
527
|
// "withdrawalFee": "0.29"
|
|
@@ -17,10 +17,11 @@ require('../static_dependencies/ethers/utils/events.js');
|
|
|
17
17
|
require('../static_dependencies/ethers/utils/fixednumber.js');
|
|
18
18
|
require('../static_dependencies/ethers/utils/maths.js');
|
|
19
19
|
require('../static_dependencies/ethers/utils/utf8.js');
|
|
20
|
-
require('../static_dependencies/noble-hashes/sha3.js');
|
|
20
|
+
var sha3 = require('../static_dependencies/noble-hashes/sha3.js');
|
|
21
21
|
var sha256 = require('../static_dependencies/noble-hashes/sha256.js');
|
|
22
22
|
require('../static_dependencies/ethers/address/address.js');
|
|
23
23
|
var typedData = require('../static_dependencies/ethers/hash/typed-data.js');
|
|
24
|
+
var secp256k1 = require('../static_dependencies/noble-curves/secp256k1.js');
|
|
24
25
|
var rng = require('../static_dependencies/jsencrypt/lib/jsbn/rng.js');
|
|
25
26
|
var index$1 = require('../static_dependencies/scure-starknet/index.js');
|
|
26
27
|
var zklinkSdkWeb = require('../static_dependencies/zklink/zklink-sdk-web.js');
|
|
@@ -1320,6 +1321,23 @@ class Exchange {
|
|
|
1320
1321
|
ethEncodeStructuredData(domain, messageTypes, messageData) {
|
|
1321
1322
|
return this.base16ToBinary(typedData.TypedDataEncoder.encode(domain, messageTypes, messageData).slice(-132));
|
|
1322
1323
|
}
|
|
1324
|
+
ethGetAddressFromPrivateKey(privateKey) {
|
|
1325
|
+
// Accepts a "0x"-prefixed hexstring private key and returns the corresponding Ethereum address
|
|
1326
|
+
// Removes the "0x" prefix if present
|
|
1327
|
+
const cleanPrivateKey = this.remove0xPrefix(privateKey);
|
|
1328
|
+
// Get the public key from the private key using secp256k1 curve
|
|
1329
|
+
const publicKeyBytes = secp256k1.secp256k1.getPublicKey(cleanPrivateKey);
|
|
1330
|
+
// For Ethereum, we need to use the uncompressed public key (without the first byte which indicates compression)
|
|
1331
|
+
// secp256k1.getPublicKey returns compressed key, we need uncompressed
|
|
1332
|
+
const publicKeyUncompressed = secp256k1.secp256k1.ProjectivePoint.fromHex(publicKeyBytes).toRawBytes(false).slice(1); // Remove 0x04 prefix
|
|
1333
|
+
// Hash the public key with Keccak256
|
|
1334
|
+
const publicKeyHash = sha3.keccak_256(publicKeyUncompressed);
|
|
1335
|
+
// Take the last 20 bytes (40 hex chars)
|
|
1336
|
+
const addressBytes = publicKeyHash.slice(-20);
|
|
1337
|
+
// Convert to hex and add 0x prefix
|
|
1338
|
+
const addressHex = '0x' + this.binaryToBase16(addressBytes);
|
|
1339
|
+
return addressHex;
|
|
1340
|
+
}
|
|
1323
1341
|
retrieveStarkAccount(signature, accountClassHash, accountProxyClassHash) {
|
|
1324
1342
|
const privateKey = index$1.ethSigToPrivate(signature);
|
|
1325
1343
|
const publicKey = index$1.getStarkKey(privateKey);
|
package/dist/cjs/src/bigone.js
CHANGED
|
@@ -856,7 +856,7 @@ class bigone extends bigone$1["default"] {
|
|
|
856
856
|
'close': close,
|
|
857
857
|
'last': close,
|
|
858
858
|
'previousClose': undefined,
|
|
859
|
-
'change': this.
|
|
859
|
+
'change': this.safeString(ticker, 'daily_change'),
|
|
860
860
|
'percentage': undefined,
|
|
861
861
|
'average': undefined,
|
|
862
862
|
'baseVolume': this.safeString2(ticker, 'volume', 'volume24h'),
|
package/dist/cjs/src/binance.js
CHANGED
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -84,6 +84,7 @@ class bingx extends bingx$1["default"] {
|
|
|
84
84
|
'fetchLiquidations': false,
|
|
85
85
|
'fetchMarginAdjustmentHistory': false,
|
|
86
86
|
'fetchMarginMode': true,
|
|
87
|
+
'fetchMarketLeverageTiers': true,
|
|
87
88
|
'fetchMarkets': true,
|
|
88
89
|
'fetchMarkOHLCV': true,
|
|
89
90
|
'fetchMarkPrice': true,
|
|
@@ -6660,6 +6661,78 @@ class bingx extends bingx$1["default"] {
|
|
|
6660
6661
|
}
|
|
6661
6662
|
return result;
|
|
6662
6663
|
}
|
|
6664
|
+
/**
|
|
6665
|
+
* @method
|
|
6666
|
+
* @name bingx#fetchMarketLeverageTiers
|
|
6667
|
+
* @description retrieve information on the maximum leverage, for different trade sizes for a single market
|
|
6668
|
+
* @see https://bingx-api.github.io/docs-v3/#/en/Swap/Trades%20Endpoints/Position%20and%20Maintenance%20Margin%20Ratio
|
|
6669
|
+
* @param {string} symbol unified market symbol
|
|
6670
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6671
|
+
* @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/?id=leverage-tiers-structure}
|
|
6672
|
+
*/
|
|
6673
|
+
async fetchMarketLeverageTiers(symbol, params = {}) {
|
|
6674
|
+
await this.loadMarkets();
|
|
6675
|
+
const market = this.market(symbol);
|
|
6676
|
+
if (!market['swap']) {
|
|
6677
|
+
throw new errors.BadRequest(this.id + ' fetchMarketLeverageTiers() supports swap markets only');
|
|
6678
|
+
}
|
|
6679
|
+
const request = {
|
|
6680
|
+
'symbol': market['id'],
|
|
6681
|
+
};
|
|
6682
|
+
const response = await this.swapV1PrivateGetMaintMarginRatio(this.extend(request, params));
|
|
6683
|
+
//
|
|
6684
|
+
// {
|
|
6685
|
+
// "code": 0,
|
|
6686
|
+
// "msg": "",
|
|
6687
|
+
// "timestamp": 1767789967284,
|
|
6688
|
+
// "data": [
|
|
6689
|
+
// {
|
|
6690
|
+
// "tier": "Tier 1",
|
|
6691
|
+
// "symbol": "ETH-USDT",
|
|
6692
|
+
// "minPositionVal": "0",
|
|
6693
|
+
// "maxPositionVal": "900000",
|
|
6694
|
+
// "maintMarginRatio": "0.003300",
|
|
6695
|
+
// "maintAmount": "0.000000"
|
|
6696
|
+
// }
|
|
6697
|
+
// ]
|
|
6698
|
+
// }
|
|
6699
|
+
//
|
|
6700
|
+
const data = this.safeList(response, 'data', []);
|
|
6701
|
+
return this.parseMarketLeverageTiers(data, market);
|
|
6702
|
+
}
|
|
6703
|
+
parseMarketLeverageTiers(info, market = undefined) {
|
|
6704
|
+
//
|
|
6705
|
+
// [
|
|
6706
|
+
// {
|
|
6707
|
+
// "tier": "Tier 1",
|
|
6708
|
+
// "symbol": "ETH-USDT",
|
|
6709
|
+
// "minPositionVal": "0",
|
|
6710
|
+
// "maxPositionVal": "900000",
|
|
6711
|
+
// "maintMarginRatio": "0.003300",
|
|
6712
|
+
// "maintAmount": "0.000000"
|
|
6713
|
+
// }
|
|
6714
|
+
// ]
|
|
6715
|
+
//
|
|
6716
|
+
const tiers = [];
|
|
6717
|
+
for (let i = 0; i < info.length; i++) {
|
|
6718
|
+
const tier = this.safeDict(info, i);
|
|
6719
|
+
const tierString = this.safeString(tier, 'tier');
|
|
6720
|
+
const tierParts = tierString.split(' ');
|
|
6721
|
+
const marketId = this.safeString(tier, 'symbol');
|
|
6722
|
+
market = this.safeMarket(marketId, market, undefined, 'swap');
|
|
6723
|
+
tiers.push({
|
|
6724
|
+
'tier': this.safeNumber(tierParts, 1),
|
|
6725
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
6726
|
+
'currency': this.safeString(market, 'settle'),
|
|
6727
|
+
'minNotional': this.safeNumber(tier, 'minPositionVal'),
|
|
6728
|
+
'maxNotional': this.safeNumber(tier, 'maxPositionVal'),
|
|
6729
|
+
'maintenanceMarginRate': this.safeNumber(tier, 'maintMarginRatio'),
|
|
6730
|
+
'maxLeverage': undefined,
|
|
6731
|
+
'info': tier,
|
|
6732
|
+
});
|
|
6733
|
+
}
|
|
6734
|
+
return tiers;
|
|
6735
|
+
}
|
|
6663
6736
|
sign(path, section = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
6664
6737
|
let type = section[0];
|
|
6665
6738
|
let version = section[1];
|
|
@@ -79,7 +79,7 @@ class cryptomus extends cryptomus$1["default"] {
|
|
|
79
79
|
'fetchConvertTradeHistory': false,
|
|
80
80
|
'fetchCrossBorrowRate': false,
|
|
81
81
|
'fetchCrossBorrowRates': false,
|
|
82
|
-
'fetchCurrencies':
|
|
82
|
+
'fetchCurrencies': false,
|
|
83
83
|
'fetchDepositAddress': false,
|
|
84
84
|
'fetchDeposits': false,
|
|
85
85
|
'fetchDepositsWithdrawals': false,
|
package/dist/cjs/src/okx.js
CHANGED
|
@@ -3010,6 +3010,9 @@ class okx extends okx$1["default"] {
|
|
|
3010
3010
|
}
|
|
3011
3011
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
3012
3012
|
const market = this.market(symbol);
|
|
3013
|
+
const takeProfitPrice = this.safeValue2(params, 'takeProfitPrice', 'tpTriggerPx');
|
|
3014
|
+
const stopLossPrice = this.safeValue2(params, 'stopLossPrice', 'slTriggerPx');
|
|
3015
|
+
const conditional = (stopLossPrice !== undefined) || (takeProfitPrice !== undefined) || (type === 'conditional');
|
|
3013
3016
|
let request = {
|
|
3014
3017
|
'instId': market['id'],
|
|
3015
3018
|
// 'ccy': currency['id'], // only applicable to cross MARGIN orders in single-currency margin
|
|
@@ -3020,7 +3023,7 @@ class okx extends okx$1["default"] {
|
|
|
3020
3023
|
'ordType': type,
|
|
3021
3024
|
// 'ordType': type, // privatePostTradeOrder: market, limit, post_only, fok, ioc, optimal_limit_ioc
|
|
3022
3025
|
// 'ordType': type, // privatePostTradeOrderAlgo: conditional, oco, trigger, move_order_stop, iceberg, twap
|
|
3023
|
-
'sz': this.amountToPrecision(symbol, amount),
|
|
3026
|
+
// 'sz': this.amountToPrecision (symbol, amount),
|
|
3024
3027
|
// 'px': this.priceToPrecision (symbol, price), // limit orders only
|
|
3025
3028
|
// 'reduceOnly': false,
|
|
3026
3029
|
//
|
|
@@ -3036,14 +3039,20 @@ class okx extends okx$1["default"] {
|
|
|
3036
3039
|
// 'slTriggerPxType': 'last', // Conditional default is last, mark or index (conditional orders)
|
|
3037
3040
|
// 'slOrdPx': 10, // Order price for Stop-Loss orders, if -1 will be executed at market price (conditional orders)
|
|
3038
3041
|
};
|
|
3042
|
+
const isConditionalOrOCO = conditional || (type === 'oco');
|
|
3043
|
+
const closeFraction = this.safeString(params, 'closeFraction');
|
|
3044
|
+
const shouldOmitSize = isConditionalOrOCO && closeFraction !== undefined;
|
|
3045
|
+
if (!shouldOmitSize) {
|
|
3046
|
+
request['sz'] = this.amountToPrecision(symbol, amount);
|
|
3047
|
+
}
|
|
3039
3048
|
const spot = market['spot'];
|
|
3040
3049
|
const contract = market['contract'];
|
|
3041
3050
|
const triggerPrice = this.safeValueN(params, ['triggerPrice', 'stopPrice', 'triggerPx']);
|
|
3042
3051
|
const timeInForce = this.safeString(params, 'timeInForce', 'GTC');
|
|
3043
|
-
const takeProfitPrice = this.safeValue2(params, 'takeProfitPrice', 'tpTriggerPx');
|
|
3052
|
+
// const takeProfitPrice = this.safeValue2 (params, 'takeProfitPrice', 'tpTriggerPx');
|
|
3044
3053
|
const tpOrdPx = this.safeValue(params, 'tpOrdPx', price);
|
|
3045
3054
|
const tpTriggerPxType = this.safeString(params, 'tpTriggerPxType', 'last');
|
|
3046
|
-
const stopLossPrice = this.safeValue2(params, 'stopLossPrice', 'slTriggerPx');
|
|
3055
|
+
// const stopLossPrice = this.safeValue2 (params, 'stopLossPrice', 'slTriggerPx');
|
|
3047
3056
|
const slOrdPx = this.safeValue(params, 'slOrdPx', price);
|
|
3048
3057
|
const slTriggerPxType = this.safeString(params, 'slTriggerPxType', 'last');
|
|
3049
3058
|
const clientOrderId = this.safeString2(params, 'clOrdId', 'clientOrderId');
|
|
@@ -3056,7 +3065,7 @@ class okx extends okx$1["default"] {
|
|
|
3056
3065
|
const trailingPrice = this.safeString2(params, 'trailingPrice', 'callbackSpread');
|
|
3057
3066
|
const isTrailingPriceOrder = trailingPrice !== undefined;
|
|
3058
3067
|
const trigger = (triggerPrice !== undefined) || (type === 'trigger');
|
|
3059
|
-
const isReduceOnly = this.safeValue(params, 'reduceOnly', false);
|
|
3068
|
+
const isReduceOnly = this.safeValue(params, 'reduceOnly', false) || (closeFraction !== undefined);
|
|
3060
3069
|
const defaultMarginMode = this.safeString2(this.options, 'defaultMarginMode', 'marginMode', 'cross');
|
|
3061
3070
|
let marginMode = this.safeString2(params, 'marginMode', 'tdMode'); // cross or isolated, tdMode not ommited so as to be extended into the request
|
|
3062
3071
|
let margin = false;
|
|
@@ -3111,7 +3120,7 @@ class okx extends okx$1["default"] {
|
|
|
3111
3120
|
params = this.omit(params, ['currency', 'ccy', 'marginMode', 'timeInForce', 'stopPrice', 'triggerPrice', 'clientOrderId', 'stopLossPrice', 'takeProfitPrice', 'slOrdPx', 'tpOrdPx', 'margin', 'stopLoss', 'takeProfit', 'trailingPercent']);
|
|
3112
3121
|
const ioc = (timeInForce === 'IOC') || (type === 'ioc');
|
|
3113
3122
|
const fok = (timeInForce === 'FOK') || (type === 'fok');
|
|
3114
|
-
const conditional = (stopLossPrice !== undefined) || (takeProfitPrice !== undefined) || (type === 'conditional');
|
|
3123
|
+
// const conditional = (stopLossPrice !== undefined) || (takeProfitPrice !== undefined) || (type === 'conditional');
|
|
3115
3124
|
const marketIOC = (isMarketOrder && ioc) || (type === 'optimal_limit_ioc');
|
|
3116
3125
|
const defaultTgtCcy = this.safeString(this.options, 'tgtCcy', 'base_ccy');
|
|
3117
3126
|
const tgtCcy = this.safeString(params, 'tgtCcy', defaultTgtCcy);
|