ccxt 4.4.67 → 4.4.69
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 +5 -5
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +5 -3
- package/dist/cjs/src/binance.js +19 -2
- package/dist/cjs/src/bitrue.js +1 -1
- package/dist/cjs/src/bitstamp.js +2 -3
- package/dist/cjs/src/bybit.js +1 -1
- package/dist/cjs/src/coinbase.js +70 -2
- package/dist/cjs/src/cryptomus.js +214 -116
- package/dist/cjs/src/hyperliquid.js +1 -1
- package/dist/cjs/src/luno.js +112 -0
- package/dist/cjs/src/paradex.js +172 -4
- package/dist/cjs/src/phemex.js +2 -2
- package/dist/cjs/src/tradeogre.js +14 -9
- package/dist/cjs/src/whitebit.js +211 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/paradex.d.ts +23 -0
- package/js/src/abstract/tradeogre.d.ts +1 -0
- package/js/src/base/Exchange.js +6 -4
- package/js/src/binance.js +19 -2
- package/js/src/bitrue.js +1 -1
- package/js/src/bitstamp.js +2 -3
- package/js/src/bybit.js +1 -1
- package/js/src/coinbase.d.ts +11 -0
- package/js/src/coinbase.js +70 -2
- package/js/src/cryptomus.d.ts +127 -1
- package/js/src/cryptomus.js +214 -116
- package/js/src/hyperliquid.js +1 -1
- package/js/src/luno.d.ts +25 -1
- package/js/src/luno.js +112 -0
- package/js/src/paradex.d.ts +48 -1
- package/js/src/paradex.js +172 -4
- package/js/src/phemex.d.ts +1 -1
- package/js/src/phemex.js +2 -2
- package/js/src/tradeogre.d.ts +1 -0
- package/js/src/tradeogre.js +14 -9
- package/js/src/whitebit.d.ts +35 -1
- package/js/src/whitebit.js +211 -1
- package/package.json +4 -4
package/js/src/whitebit.js
CHANGED
|
@@ -22,7 +22,7 @@ export default class whitebit extends Exchange {
|
|
|
22
22
|
'CORS': undefined,
|
|
23
23
|
'spot': true,
|
|
24
24
|
'margin': true,
|
|
25
|
-
'swap':
|
|
25
|
+
'swap': true,
|
|
26
26
|
'future': false,
|
|
27
27
|
'option': false,
|
|
28
28
|
'cancelAllOrders': true,
|
|
@@ -72,7 +72,10 @@ export default class whitebit extends Exchange {
|
|
|
72
72
|
'fetchOpenOrders': true,
|
|
73
73
|
'fetchOrderBook': true,
|
|
74
74
|
'fetchOrderTrades': true,
|
|
75
|
+
'fetchPosition': true,
|
|
76
|
+
'fetchPositionHistory': true,
|
|
75
77
|
'fetchPositionMode': false,
|
|
78
|
+
'fetchPositions': true,
|
|
76
79
|
'fetchPremiumIndexOHLCV': false,
|
|
77
80
|
'fetchStatus': true,
|
|
78
81
|
'fetchTicker': true,
|
|
@@ -2958,6 +2961,213 @@ export default class whitebit extends Exchange {
|
|
|
2958
2961
|
'fee': undefined,
|
|
2959
2962
|
};
|
|
2960
2963
|
}
|
|
2964
|
+
/**
|
|
2965
|
+
* @method
|
|
2966
|
+
* @name whitebit#fetchPositionHistory
|
|
2967
|
+
* @description fetches historical positions
|
|
2968
|
+
* @see https://docs.whitebit.com/private/http-trade-v4/#positions-history
|
|
2969
|
+
* @param {string} symbol unified contract symbol
|
|
2970
|
+
* @param {int} [since] the earliest time in ms to fetch positions for
|
|
2971
|
+
* @param {int} [limit] the maximum amount of records to fetch
|
|
2972
|
+
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
2973
|
+
* @param {int} [params.positionId] the id of the requested position
|
|
2974
|
+
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
2975
|
+
*/
|
|
2976
|
+
async fetchPositionHistory(symbol, since = undefined, limit = undefined, params = {}) {
|
|
2977
|
+
await this.loadMarkets();
|
|
2978
|
+
const market = this.market(symbol);
|
|
2979
|
+
let request = {
|
|
2980
|
+
'market': market['id'],
|
|
2981
|
+
};
|
|
2982
|
+
if (since !== undefined) {
|
|
2983
|
+
request['startDate'] = since;
|
|
2984
|
+
}
|
|
2985
|
+
if (limit !== undefined) {
|
|
2986
|
+
request['limit'] = since;
|
|
2987
|
+
}
|
|
2988
|
+
[request, params] = this.handleUntilOption('endDate', request, params);
|
|
2989
|
+
const response = await this.v4PrivatePostCollateralAccountPositionsHistory(this.extend(request, params));
|
|
2990
|
+
//
|
|
2991
|
+
// [
|
|
2992
|
+
// {
|
|
2993
|
+
// "positionId": 479975679,
|
|
2994
|
+
// "market": "BTC_PERP",
|
|
2995
|
+
// "openDate": 1741941025.309887,
|
|
2996
|
+
// "modifyDate": 1741941025.309887,
|
|
2997
|
+
// "amount": "0.001",
|
|
2998
|
+
// "basePrice": "82498.7",
|
|
2999
|
+
// "realizedFunding": "0",
|
|
3000
|
+
// "liquidationPrice": "0",
|
|
3001
|
+
// "liquidationState": null,
|
|
3002
|
+
// "orderDetail": {
|
|
3003
|
+
// "id": 1224727949521,
|
|
3004
|
+
// "tradeAmount": "0.001",
|
|
3005
|
+
// "price": "82498.7",
|
|
3006
|
+
// "tradeFee": "0.028874545",
|
|
3007
|
+
// "fundingFee": "0",
|
|
3008
|
+
// "realizedPnl": "-0.028874545"
|
|
3009
|
+
// }
|
|
3010
|
+
// }
|
|
3011
|
+
// ]
|
|
3012
|
+
//
|
|
3013
|
+
const positions = this.parsePositions(response);
|
|
3014
|
+
return this.filterBySymbolSinceLimit(positions, symbol, since, limit);
|
|
3015
|
+
}
|
|
3016
|
+
/**
|
|
3017
|
+
* @method
|
|
3018
|
+
* @name whitebit#fetchPositions
|
|
3019
|
+
* @description fetch all open positions
|
|
3020
|
+
* @see https://docs.whitebit.com/private/http-trade-v4/#open-positions
|
|
3021
|
+
* @param {string[]} [symbols] list of unified market symbols
|
|
3022
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3023
|
+
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
3024
|
+
*/
|
|
3025
|
+
async fetchPositions(symbols = undefined, params = {}) {
|
|
3026
|
+
await this.loadMarkets();
|
|
3027
|
+
symbols = this.marketSymbols(symbols);
|
|
3028
|
+
const response = await this.v4PrivatePostCollateralAccountPositionsOpen(params);
|
|
3029
|
+
//
|
|
3030
|
+
// [
|
|
3031
|
+
// {
|
|
3032
|
+
// "positionId": 479975679,
|
|
3033
|
+
// "market": "BTC_PERP",
|
|
3034
|
+
// "openDate": 1741941025.3098869,
|
|
3035
|
+
// "modifyDate": 1741941025.3098869,
|
|
3036
|
+
// "amount": "0.001",
|
|
3037
|
+
// "basePrice": "82498.7",
|
|
3038
|
+
// "liquidationPrice": "70177.2",
|
|
3039
|
+
// "pnl": "0",
|
|
3040
|
+
// "pnlPercent": "0.00",
|
|
3041
|
+
// "margin": "4.2",
|
|
3042
|
+
// "freeMargin": "9.9",
|
|
3043
|
+
// "funding": "0",
|
|
3044
|
+
// "unrealizedFunding": "0",
|
|
3045
|
+
// "liquidationState": null,
|
|
3046
|
+
// "tpsl": null
|
|
3047
|
+
// }
|
|
3048
|
+
// ]
|
|
3049
|
+
//
|
|
3050
|
+
return this.parsePositions(response, symbols);
|
|
3051
|
+
}
|
|
3052
|
+
/**
|
|
3053
|
+
* @method
|
|
3054
|
+
* @name whitebit#fetchPosition
|
|
3055
|
+
* @description fetch data on a single open contract trade position
|
|
3056
|
+
* @see https://docs.whitebit.com/private/http-trade-v4/#open-positions
|
|
3057
|
+
* @param {string} symbol unified market symbol of the market the position is held in
|
|
3058
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3059
|
+
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
3060
|
+
*/
|
|
3061
|
+
async fetchPosition(symbol, params = {}) {
|
|
3062
|
+
await this.loadMarkets();
|
|
3063
|
+
const market = this.market(symbol);
|
|
3064
|
+
const request = {
|
|
3065
|
+
'symbol': market['id'],
|
|
3066
|
+
};
|
|
3067
|
+
const response = await this.v4PrivatePostCollateralAccountPositionsOpen(this.extend(request, params));
|
|
3068
|
+
//
|
|
3069
|
+
// [
|
|
3070
|
+
// {
|
|
3071
|
+
// "positionId": 479975679,
|
|
3072
|
+
// "market": "BTC_PERP",
|
|
3073
|
+
// "openDate": 1741941025.3098869,
|
|
3074
|
+
// "modifyDate": 1741941025.3098869,
|
|
3075
|
+
// "amount": "0.001",
|
|
3076
|
+
// "basePrice": "82498.7",
|
|
3077
|
+
// "liquidationPrice": "70177.2",
|
|
3078
|
+
// "pnl": "0",
|
|
3079
|
+
// "pnlPercent": "0.00",
|
|
3080
|
+
// "margin": "4.2",
|
|
3081
|
+
// "freeMargin": "9.9",
|
|
3082
|
+
// "funding": "0",
|
|
3083
|
+
// "unrealizedFunding": "0",
|
|
3084
|
+
// "liquidationState": null,
|
|
3085
|
+
// "tpsl": null
|
|
3086
|
+
// }
|
|
3087
|
+
// ]
|
|
3088
|
+
//
|
|
3089
|
+
const data = this.safeDict(response, 0, {});
|
|
3090
|
+
return this.parsePosition(data, market);
|
|
3091
|
+
}
|
|
3092
|
+
parsePosition(position, market = undefined) {
|
|
3093
|
+
//
|
|
3094
|
+
// fetchPosition, fetchPositions
|
|
3095
|
+
//
|
|
3096
|
+
// {
|
|
3097
|
+
// "positionId": 479975679,
|
|
3098
|
+
// "market": "BTC_PERP",
|
|
3099
|
+
// "openDate": 1741941025.3098869,
|
|
3100
|
+
// "modifyDate": 1741941025.3098869,
|
|
3101
|
+
// "amount": "0.001",
|
|
3102
|
+
// "basePrice": "82498.7",
|
|
3103
|
+
// "liquidationPrice": "70177.2",
|
|
3104
|
+
// "pnl": "0",
|
|
3105
|
+
// "pnlPercent": "0.00",
|
|
3106
|
+
// "margin": "4.2",
|
|
3107
|
+
// "freeMargin": "9.9",
|
|
3108
|
+
// "funding": "0",
|
|
3109
|
+
// "unrealizedFunding": "0",
|
|
3110
|
+
// "liquidationState": null,
|
|
3111
|
+
// "tpsl": null
|
|
3112
|
+
// }
|
|
3113
|
+
//
|
|
3114
|
+
// fetchPositionHistory
|
|
3115
|
+
//
|
|
3116
|
+
// {
|
|
3117
|
+
// "positionId": 479975679,
|
|
3118
|
+
// "market": "BTC_PERP",
|
|
3119
|
+
// "openDate": 1741941025.309887,
|
|
3120
|
+
// "modifyDate": 1741941025.309887,
|
|
3121
|
+
// "amount": "0.001",
|
|
3122
|
+
// "basePrice": "82498.7",
|
|
3123
|
+
// "realizedFunding": "0",
|
|
3124
|
+
// "liquidationPrice": "0",
|
|
3125
|
+
// "liquidationState": null,
|
|
3126
|
+
// "orderDetail": {
|
|
3127
|
+
// "id": 1224727949521,
|
|
3128
|
+
// "tradeAmount": "0.001",
|
|
3129
|
+
// "price": "82498.7",
|
|
3130
|
+
// "tradeFee": "0.028874545",
|
|
3131
|
+
// "fundingFee": "0",
|
|
3132
|
+
// "realizedPnl": "-0.028874545"
|
|
3133
|
+
// }
|
|
3134
|
+
// }
|
|
3135
|
+
//
|
|
3136
|
+
const marketId = this.safeString(position, 'market');
|
|
3137
|
+
const timestamp = this.safeTimestamp(position, 'openDate');
|
|
3138
|
+
const tpsl = this.safeDict(position, 'tpsl', {});
|
|
3139
|
+
const orderDetail = this.safeDict(position, 'orderDetail', {});
|
|
3140
|
+
return this.safePosition({
|
|
3141
|
+
'info': position,
|
|
3142
|
+
'id': this.safeString(position, 'positionId'),
|
|
3143
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
3144
|
+
'notional': undefined,
|
|
3145
|
+
'marginMode': undefined,
|
|
3146
|
+
'liquidationPrice': this.safeNumber(position, 'liquidationPrice'),
|
|
3147
|
+
'entryPrice': this.safeNumber(position, 'basePrice'),
|
|
3148
|
+
'unrealizedPnl': this.safeNumber(position, 'pnl'),
|
|
3149
|
+
'realizedPnl': this.safeNumber(orderDetail, 'realizedPnl'),
|
|
3150
|
+
'percentage': this.safeNumber(position, 'pnlPercent'),
|
|
3151
|
+
'contracts': undefined,
|
|
3152
|
+
'contractSize': undefined,
|
|
3153
|
+
'markPrice': undefined,
|
|
3154
|
+
'lastPrice': undefined,
|
|
3155
|
+
'side': undefined,
|
|
3156
|
+
'hedged': undefined,
|
|
3157
|
+
'timestamp': timestamp,
|
|
3158
|
+
'datetime': this.iso8601(timestamp),
|
|
3159
|
+
'lastUpdateTimestamp': this.safeTimestamp(position, 'modifyDate'),
|
|
3160
|
+
'maintenanceMargin': undefined,
|
|
3161
|
+
'maintenanceMarginPercentage': undefined,
|
|
3162
|
+
'collateral': this.safeNumber(position, 'margin'),
|
|
3163
|
+
'initialMargin': undefined,
|
|
3164
|
+
'initialMarginPercentage': undefined,
|
|
3165
|
+
'leverage': undefined,
|
|
3166
|
+
'marginRatio': undefined,
|
|
3167
|
+
'stopLossPrice': this.safeNumber(tpsl, 'stopLoss'),
|
|
3168
|
+
'takeProfitPrice': this.safeNumber(tpsl, 'takeProfit'),
|
|
3169
|
+
});
|
|
3170
|
+
}
|
|
2961
3171
|
isFiat(currency) {
|
|
2962
3172
|
const fiatCurrencies = this.safeValue(this.options, 'fiatCurrencies', []);
|
|
2963
3173
|
return this.inArray(currency, fiatCurrencies);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccxt",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.69",
|
|
4
4
|
"description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
|
|
5
5
|
"unpkg": "dist/ccxt.browser.min.js",
|
|
6
6
|
"type": "module",
|
|
@@ -195,8 +195,8 @@
|
|
|
195
195
|
"@types/node": "^18.15.11",
|
|
196
196
|
"@typescript-eslint/eslint-plugin": "^5.30.5",
|
|
197
197
|
"@typescript-eslint/parser": "^5.30.5",
|
|
198
|
-
"ansicolor": "
|
|
199
|
-
"as-table": "1.0.
|
|
198
|
+
"ansicolor": "^2.0.0",
|
|
199
|
+
"as-table": "^1.0.55",
|
|
200
200
|
"asciichart": "^1.5.25",
|
|
201
201
|
"assert": "^2.0.0",
|
|
202
202
|
"ast-transpiler": "^0.0.65",
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
"esmify": "^2.1.1",
|
|
209
209
|
"https-proxy-agent": "^5.0.1",
|
|
210
210
|
"jsdoc-to-markdown": "^8.0.0",
|
|
211
|
-
"ololog": "1.1.
|
|
211
|
+
"ololog": "^1.1.175",
|
|
212
212
|
"piscina": "^3.2.0",
|
|
213
213
|
"replace-in-file": "^6.3.5",
|
|
214
214
|
"rollup": "^2.70.1",
|