ccxt 4.4.61 → 4.4.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +56 -34
- package/dist/cjs/src/bingx.js +6 -7
- package/dist/cjs/src/bybit.js +113 -2
- package/dist/cjs/src/kraken.js +2 -2
- package/dist/cjs/src/phemex.js +226 -4
- package/dist/cjs/src/pro/binance.js +26 -11
- package/dist/cjs/src/pro/lbank.js +11 -4
- package/dist/cjs/src/pro/myokx.js +10 -1
- package/dist/cjs/src/whitebit.js +3 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bybit.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +3 -1
- package/js/src/base/Exchange.js +56 -34
- package/js/src/bingx.js +6 -7
- package/js/src/bybit.d.ts +22 -0
- package/js/src/bybit.js +113 -2
- package/js/src/kraken.js +2 -2
- package/js/src/phemex.d.ts +42 -1
- package/js/src/phemex.js +226 -4
- package/js/src/pro/binance.d.ts +8 -0
- package/js/src/pro/binance.js +26 -11
- package/js/src/pro/lbank.js +11 -4
- package/js/src/pro/myokx.js +10 -1
- package/js/src/whitebit.js +3 -1
- package/package.json +1 -1
package/js/src/kraken.js
CHANGED
|
@@ -979,9 +979,9 @@ export default class kraken extends Exchange {
|
|
|
979
979
|
'high': this.safeString(high, 1),
|
|
980
980
|
'low': this.safeString(low, 1),
|
|
981
981
|
'bid': this.safeString(bid, 0),
|
|
982
|
-
'bidVolume':
|
|
982
|
+
'bidVolume': this.safeString(bid, 2),
|
|
983
983
|
'ask': this.safeString(ask, 0),
|
|
984
|
-
'askVolume':
|
|
984
|
+
'askVolume': this.safeString(ask, 2),
|
|
985
985
|
'vwap': vwap,
|
|
986
986
|
'open': this.safeString(ticker, 'o'),
|
|
987
987
|
'close': last,
|
package/js/src/phemex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/phemex.js';
|
|
2
|
-
import type { TransferEntry, Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, MarginModification, Currencies, Dict, LeverageTier, LeverageTiers, int, FundingRate, DepositAddress } from './base/types.js';
|
|
2
|
+
import type { TransferEntry, Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, MarginModification, Currencies, Dict, LeverageTier, LeverageTiers, int, FundingRate, DepositAddress, Conversion } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class phemex
|
|
5
5
|
* @augments Exchange
|
|
@@ -451,5 +451,46 @@ export default class phemex extends Exchange {
|
|
|
451
451
|
*/
|
|
452
452
|
fetchOpenInterest(symbol: string, params?: {}): Promise<import("./base/types.js").OpenInterest>;
|
|
453
453
|
parseOpenInterest(interest: any, market?: Market): import("./base/types.js").OpenInterest;
|
|
454
|
+
/**
|
|
455
|
+
* @method
|
|
456
|
+
* @name phemex#fetchConvertQuote
|
|
457
|
+
* @description fetch a quote for converting from one currency to another
|
|
458
|
+
* @see https://phemex-docs.github.io/#rfq-quote
|
|
459
|
+
* @param {string} fromCode the currency that you want to sell and convert from
|
|
460
|
+
* @param {string} toCode the currency that you want to buy and convert into
|
|
461
|
+
* @param {float} amount how much you want to trade in units of the from currency
|
|
462
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
463
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
464
|
+
*/
|
|
465
|
+
fetchConvertQuote(fromCode: string, toCode: string, amount?: Num, params?: {}): Promise<Conversion>;
|
|
466
|
+
/**
|
|
467
|
+
* @method
|
|
468
|
+
* @name phemex#createConvertTrade
|
|
469
|
+
* @description convert from one currency to another
|
|
470
|
+
* @see https://phemex-docs.github.io/#convert
|
|
471
|
+
* @param {string} id the id of the trade that you want to make
|
|
472
|
+
* @param {string} fromCode the currency that you want to sell and convert from
|
|
473
|
+
* @param {string} toCode the currency that you want to buy and convert into
|
|
474
|
+
* @param {float} [amount] how much you want to trade in units of the from currency
|
|
475
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
476
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
477
|
+
*/
|
|
478
|
+
createConvertTrade(id: string, fromCode: string, toCode: string, amount?: Num, params?: {}): Promise<Conversion>;
|
|
479
|
+
/**
|
|
480
|
+
* @method
|
|
481
|
+
* @name phemex#fetchConvertTradeHistory
|
|
482
|
+
* @description fetch the users history of conversion trades
|
|
483
|
+
* @see https://phemex-docs.github.io/#query-convert-history
|
|
484
|
+
* @param {string} [code] the unified currency code
|
|
485
|
+
* @param {int} [since] the earliest time in ms to fetch conversions for
|
|
486
|
+
* @param {int} [limit] the maximum number of conversion structures to retrieve, default 20, max 200
|
|
487
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
488
|
+
* @param {string} [params.until] the end time in ms
|
|
489
|
+
* @param {string} [params.fromCurrency] the currency that you sold and converted from
|
|
490
|
+
* @param {string} [params.toCurrency] the currency that you bought and converted into
|
|
491
|
+
* @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
492
|
+
*/
|
|
493
|
+
fetchConvertTradeHistory(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Conversion[]>;
|
|
494
|
+
parseConversion(conversion: Dict, fromCurrency?: Currency, toCurrency?: Currency): Conversion;
|
|
454
495
|
handleErrors(httpCode: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any;
|
|
455
496
|
}
|
package/js/src/phemex.js
CHANGED
|
@@ -37,6 +37,7 @@ export default class phemex extends Exchange {
|
|
|
37
37
|
'cancelAllOrders': true,
|
|
38
38
|
'cancelOrder': true,
|
|
39
39
|
'closePosition': false,
|
|
40
|
+
'createConvertTrade': true,
|
|
40
41
|
'createOrder': true,
|
|
41
42
|
'createReduceOnlyOrder': true,
|
|
42
43
|
'createStopLimitOrder': true,
|
|
@@ -47,6 +48,9 @@ export default class phemex extends Exchange {
|
|
|
47
48
|
'fetchBorrowRateHistories': false,
|
|
48
49
|
'fetchBorrowRateHistory': false,
|
|
49
50
|
'fetchClosedOrders': true,
|
|
51
|
+
'fetchConvertQuote': true,
|
|
52
|
+
'fetchConvertTrade': false,
|
|
53
|
+
'fetchConvertTradeHistory': true,
|
|
50
54
|
'fetchCrossBorrowRate': false,
|
|
51
55
|
'fetchCrossBorrowRates': false,
|
|
52
56
|
'fetchCurrencies': true,
|
|
@@ -1070,7 +1074,7 @@ export default class phemex extends Exchange {
|
|
|
1070
1074
|
for (let i = 0; i < products.length; i++) {
|
|
1071
1075
|
let market = products[i];
|
|
1072
1076
|
const type = this.safeStringLower(market, 'type');
|
|
1073
|
-
if ((type === 'perpetual') || (type === 'perpetualv2') || (type === '
|
|
1077
|
+
if ((type === 'perpetual') || (type === 'perpetualv2') || (type === 'perpetualpilot')) {
|
|
1074
1078
|
const id = this.safeString(market, 'symbol');
|
|
1075
1079
|
const riskLimitValues = this.safeValue(riskLimitsById, id, {});
|
|
1076
1080
|
market = this.extend(market, riskLimitValues);
|
|
@@ -1261,7 +1265,7 @@ export default class phemex extends Exchange {
|
|
|
1261
1265
|
precise.decimals = precise.decimals - scale;
|
|
1262
1266
|
precise.reduce();
|
|
1263
1267
|
const preciseString = precise.toString();
|
|
1264
|
-
return this.
|
|
1268
|
+
return this.parseToNumeric(preciseString);
|
|
1265
1269
|
}
|
|
1266
1270
|
toEv(amount, market = undefined) {
|
|
1267
1271
|
if ((amount === undefined) || (market === undefined)) {
|
|
@@ -2628,7 +2632,6 @@ export default class phemex extends Exchange {
|
|
|
2628
2632
|
const market = this.market(symbol);
|
|
2629
2633
|
const requestSide = this.capitalize(side);
|
|
2630
2634
|
type = this.capitalize(type);
|
|
2631
|
-
const reduceOnly = this.safeBool(params, 'reduceOnly');
|
|
2632
2635
|
const request = {
|
|
2633
2636
|
// common
|
|
2634
2637
|
'symbol': market['id'],
|
|
@@ -2728,8 +2731,10 @@ export default class phemex extends Exchange {
|
|
|
2728
2731
|
let posSide = this.safeStringLower(params, 'posSide');
|
|
2729
2732
|
if (posSide === undefined) {
|
|
2730
2733
|
if (hedged) {
|
|
2734
|
+
const reduceOnly = this.safeBool(params, 'reduceOnly');
|
|
2731
2735
|
if (reduceOnly) {
|
|
2732
2736
|
side = (side === 'buy') ? 'sell' : 'buy';
|
|
2737
|
+
params = this.omit(params, 'reduceOnly');
|
|
2733
2738
|
}
|
|
2734
2739
|
posSide = (side === 'buy') ? 'Long' : 'Short';
|
|
2735
2740
|
}
|
|
@@ -2844,7 +2849,6 @@ export default class phemex extends Exchange {
|
|
|
2844
2849
|
}
|
|
2845
2850
|
params = this.omit(params, 'stopLossPrice');
|
|
2846
2851
|
}
|
|
2847
|
-
params = this.omit(params, 'reduceOnly');
|
|
2848
2852
|
let response = undefined;
|
|
2849
2853
|
if (market['settle'] === 'USDT') {
|
|
2850
2854
|
response = await this.privatePostGOrders(this.extend(request, params));
|
|
@@ -5069,6 +5073,224 @@ export default class phemex extends Exchange {
|
|
|
5069
5073
|
'datetime': this.iso8601(timestamp),
|
|
5070
5074
|
}, market);
|
|
5071
5075
|
}
|
|
5076
|
+
/**
|
|
5077
|
+
* @method
|
|
5078
|
+
* @name phemex#fetchConvertQuote
|
|
5079
|
+
* @description fetch a quote for converting from one currency to another
|
|
5080
|
+
* @see https://phemex-docs.github.io/#rfq-quote
|
|
5081
|
+
* @param {string} fromCode the currency that you want to sell and convert from
|
|
5082
|
+
* @param {string} toCode the currency that you want to buy and convert into
|
|
5083
|
+
* @param {float} amount how much you want to trade in units of the from currency
|
|
5084
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5085
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
5086
|
+
*/
|
|
5087
|
+
async fetchConvertQuote(fromCode, toCode, amount = undefined, params = {}) {
|
|
5088
|
+
await this.loadMarkets();
|
|
5089
|
+
const fromCurrency = this.currency(fromCode);
|
|
5090
|
+
const toCurrency = this.currency(toCode);
|
|
5091
|
+
const valueScale = this.safeInteger(fromCurrency, 'valueScale');
|
|
5092
|
+
const request = {
|
|
5093
|
+
'fromCurrency': fromCode,
|
|
5094
|
+
'toCurrency': toCode,
|
|
5095
|
+
'fromAmountEv': this.toEn(amount, valueScale),
|
|
5096
|
+
};
|
|
5097
|
+
const response = await this.privateGetAssetsQuote(this.extend(request, params));
|
|
5098
|
+
//
|
|
5099
|
+
// {
|
|
5100
|
+
// "code": 0,
|
|
5101
|
+
// "msg": "OK",
|
|
5102
|
+
// "data": {
|
|
5103
|
+
// "code": "GIF...AAA",
|
|
5104
|
+
// "quoteArgs": {
|
|
5105
|
+
// "origin": 10,
|
|
5106
|
+
// "price": "0.00000939",
|
|
5107
|
+
// "proceeds": "0.00000000",
|
|
5108
|
+
// "ttlMs": 7000,
|
|
5109
|
+
// "expireAt": 1739875826009,
|
|
5110
|
+
// "requestAt": 1739875818009,
|
|
5111
|
+
// "quoteAt": 1739875816594
|
|
5112
|
+
// }
|
|
5113
|
+
// }
|
|
5114
|
+
// }
|
|
5115
|
+
//
|
|
5116
|
+
const data = this.safeDict(response, 'data', {});
|
|
5117
|
+
return this.parseConversion(data, fromCurrency, toCurrency);
|
|
5118
|
+
}
|
|
5119
|
+
/**
|
|
5120
|
+
* @method
|
|
5121
|
+
* @name phemex#createConvertTrade
|
|
5122
|
+
* @description convert from one currency to another
|
|
5123
|
+
* @see https://phemex-docs.github.io/#convert
|
|
5124
|
+
* @param {string} id the id of the trade that you want to make
|
|
5125
|
+
* @param {string} fromCode the currency that you want to sell and convert from
|
|
5126
|
+
* @param {string} toCode the currency that you want to buy and convert into
|
|
5127
|
+
* @param {float} [amount] how much you want to trade in units of the from currency
|
|
5128
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5129
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
5130
|
+
*/
|
|
5131
|
+
async createConvertTrade(id, fromCode, toCode, amount = undefined, params = {}) {
|
|
5132
|
+
await this.loadMarkets();
|
|
5133
|
+
const fromCurrency = this.currency(fromCode);
|
|
5134
|
+
const toCurrency = this.currency(toCode);
|
|
5135
|
+
const valueScale = this.safeInteger(fromCurrency, 'valueScale');
|
|
5136
|
+
const request = {
|
|
5137
|
+
'code': id,
|
|
5138
|
+
'fromCurrency': fromCode,
|
|
5139
|
+
'toCurrency': toCode,
|
|
5140
|
+
};
|
|
5141
|
+
if (amount !== undefined) {
|
|
5142
|
+
request['fromAmountEv'] = this.toEn(amount, valueScale);
|
|
5143
|
+
}
|
|
5144
|
+
const response = await this.privatePostAssetsConvert(this.extend(request, params));
|
|
5145
|
+
//
|
|
5146
|
+
// {
|
|
5147
|
+
// "code": 0,
|
|
5148
|
+
// "msg": "OK",
|
|
5149
|
+
// "data": {
|
|
5150
|
+
// "moveOp": 0,
|
|
5151
|
+
// "fromCurrency": "USDT",
|
|
5152
|
+
// "toCurrency": "BTC",
|
|
5153
|
+
// "fromAmountEv": 4000000000,
|
|
5154
|
+
// "toAmountEv": 41511,
|
|
5155
|
+
// "linkKey": "45c8ed8e-d3f4-472d-8262-e464e8c46247",
|
|
5156
|
+
// "status": 10
|
|
5157
|
+
// }
|
|
5158
|
+
// }
|
|
5159
|
+
//
|
|
5160
|
+
const data = this.safeDict(response, 'data', {});
|
|
5161
|
+
const fromCurrencyId = this.safeString(data, 'fromCurrency');
|
|
5162
|
+
const fromResult = this.safeCurrency(fromCurrencyId, fromCurrency);
|
|
5163
|
+
const toCurrencyId = this.safeString(data, 'toCurrency');
|
|
5164
|
+
const to = this.safeCurrency(toCurrencyId, toCurrency);
|
|
5165
|
+
return this.parseConversion(data, fromResult, to);
|
|
5166
|
+
}
|
|
5167
|
+
/**
|
|
5168
|
+
* @method
|
|
5169
|
+
* @name phemex#fetchConvertTradeHistory
|
|
5170
|
+
* @description fetch the users history of conversion trades
|
|
5171
|
+
* @see https://phemex-docs.github.io/#query-convert-history
|
|
5172
|
+
* @param {string} [code] the unified currency code
|
|
5173
|
+
* @param {int} [since] the earliest time in ms to fetch conversions for
|
|
5174
|
+
* @param {int} [limit] the maximum number of conversion structures to retrieve, default 20, max 200
|
|
5175
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5176
|
+
* @param {string} [params.until] the end time in ms
|
|
5177
|
+
* @param {string} [params.fromCurrency] the currency that you sold and converted from
|
|
5178
|
+
* @param {string} [params.toCurrency] the currency that you bought and converted into
|
|
5179
|
+
* @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
5180
|
+
*/
|
|
5181
|
+
async fetchConvertTradeHistory(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
5182
|
+
await this.loadMarkets();
|
|
5183
|
+
let request = {};
|
|
5184
|
+
if (code !== undefined) {
|
|
5185
|
+
request['fromCurrency'] = code;
|
|
5186
|
+
}
|
|
5187
|
+
if (since !== undefined) {
|
|
5188
|
+
request['startTime'] = since;
|
|
5189
|
+
}
|
|
5190
|
+
if (limit !== undefined) {
|
|
5191
|
+
request['limit'] = limit;
|
|
5192
|
+
}
|
|
5193
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
5194
|
+
const response = await this.privateGetAssetsConvert(this.extend(request, params));
|
|
5195
|
+
//
|
|
5196
|
+
// {
|
|
5197
|
+
// "code": 0,
|
|
5198
|
+
// "msg": "OK",
|
|
5199
|
+
// "data": {
|
|
5200
|
+
// "total": 2,
|
|
5201
|
+
// "rows": [
|
|
5202
|
+
// {
|
|
5203
|
+
// "linkKey": "45c8ed8e-d3f4-472d-8262-e464e8c46247",
|
|
5204
|
+
// "createTime": 1739882294000,
|
|
5205
|
+
// "fromCurrency": "USDT",
|
|
5206
|
+
// "toCurrency": "BTC",
|
|
5207
|
+
// "fromAmountEv": 4000000000,
|
|
5208
|
+
// "toAmountEv": 41511,
|
|
5209
|
+
// "status": 10,
|
|
5210
|
+
// "conversionRate": 1037,
|
|
5211
|
+
// "errorCode": 0
|
|
5212
|
+
// },
|
|
5213
|
+
// ]
|
|
5214
|
+
// }
|
|
5215
|
+
// }
|
|
5216
|
+
//
|
|
5217
|
+
const data = this.safeDict(response, 'data', {});
|
|
5218
|
+
const rows = this.safeList(data, 'rows', []);
|
|
5219
|
+
return this.parseConversions(rows, code, 'fromCurrency', 'toCurrency', since, limit);
|
|
5220
|
+
}
|
|
5221
|
+
parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
|
|
5222
|
+
//
|
|
5223
|
+
// fetchConvertQuote
|
|
5224
|
+
//
|
|
5225
|
+
// {
|
|
5226
|
+
// "code": "GIF...AAA",
|
|
5227
|
+
// "quoteArgs": {
|
|
5228
|
+
// "origin": 10,
|
|
5229
|
+
// "price": "0.00000939",
|
|
5230
|
+
// "proceeds": "0.00000000",
|
|
5231
|
+
// "ttlMs": 7000,
|
|
5232
|
+
// "expireAt": 1739875826009,
|
|
5233
|
+
// "requestAt": 1739875818009,
|
|
5234
|
+
// "quoteAt": 1739875816594
|
|
5235
|
+
// }
|
|
5236
|
+
// }
|
|
5237
|
+
//
|
|
5238
|
+
// createConvertTrade
|
|
5239
|
+
//
|
|
5240
|
+
// {
|
|
5241
|
+
// "moveOp": 0,
|
|
5242
|
+
// "fromCurrency": "USDT",
|
|
5243
|
+
// "toCurrency": "BTC",
|
|
5244
|
+
// "fromAmountEv": 4000000000,
|
|
5245
|
+
// "toAmountEv": 41511,
|
|
5246
|
+
// "linkKey": "45c8ed8e-d3f4-472d-8262-e464e8c46247",
|
|
5247
|
+
// "status": 10
|
|
5248
|
+
// }
|
|
5249
|
+
//
|
|
5250
|
+
// fetchConvertTradeHistory
|
|
5251
|
+
//
|
|
5252
|
+
// {
|
|
5253
|
+
// "linkKey": "45c8ed8e-d3f4-472d-8262-e464e8c46247",
|
|
5254
|
+
// "createTime": 1739882294000,
|
|
5255
|
+
// "fromCurrency": "USDT",
|
|
5256
|
+
// "toCurrency": "BTC",
|
|
5257
|
+
// "fromAmountEv": 4000000000,
|
|
5258
|
+
// "toAmountEv": 41511,
|
|
5259
|
+
// "status": 10,
|
|
5260
|
+
// "conversionRate": 1037,
|
|
5261
|
+
// "errorCode": 0
|
|
5262
|
+
// }
|
|
5263
|
+
//
|
|
5264
|
+
const quoteArgs = this.safeDict(conversion, 'quoteArgs', {});
|
|
5265
|
+
const requestTime = this.safeInteger(quoteArgs, 'requestAt');
|
|
5266
|
+
const timestamp = this.safeInteger(conversion, 'createTime', requestTime);
|
|
5267
|
+
const fromCoin = this.safeString(conversion, 'fromCurrency', this.safeString(fromCurrency, 'code'));
|
|
5268
|
+
const fromCode = this.safeCurrencyCode(fromCoin, fromCurrency);
|
|
5269
|
+
const toCoin = this.safeString(conversion, 'toCurrency', this.safeString(toCurrency, 'code'));
|
|
5270
|
+
const toCode = this.safeCurrencyCode(toCoin, toCurrency);
|
|
5271
|
+
const fromValueScale = this.safeInteger(fromCurrency, 'valueScale');
|
|
5272
|
+
const toValueScale = this.safeInteger(toCurrency, 'valueScale');
|
|
5273
|
+
let fromAmount = this.fromEn(this.safeString(conversion, 'fromAmountEv'), fromValueScale);
|
|
5274
|
+
if (fromAmount === undefined && quoteArgs !== undefined) {
|
|
5275
|
+
fromAmount = this.fromEn(this.safeString(quoteArgs, 'origin'), fromValueScale);
|
|
5276
|
+
}
|
|
5277
|
+
let toAmount = this.fromEn(this.safeString(conversion, 'toAmountEv'), toValueScale);
|
|
5278
|
+
if (toAmount === undefined && quoteArgs !== undefined) {
|
|
5279
|
+
toAmount = this.fromEn(this.safeString(quoteArgs, 'proceeds'), toValueScale);
|
|
5280
|
+
}
|
|
5281
|
+
return {
|
|
5282
|
+
'info': conversion,
|
|
5283
|
+
'timestamp': timestamp,
|
|
5284
|
+
'datetime': this.iso8601(timestamp),
|
|
5285
|
+
'id': this.safeString(conversion, 'code'),
|
|
5286
|
+
'fromCurrency': fromCode,
|
|
5287
|
+
'fromAmount': this.parseNumber(fromAmount),
|
|
5288
|
+
'toCurrency': toCode,
|
|
5289
|
+
'toAmount': this.parseNumber(toAmount),
|
|
5290
|
+
'price': this.safeNumber(quoteArgs, 'price'),
|
|
5291
|
+
'fee': undefined,
|
|
5292
|
+
};
|
|
5293
|
+
}
|
|
5072
5294
|
handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
5073
5295
|
if (response === undefined) {
|
|
5074
5296
|
return undefined; // fallback to default error handler
|
package/js/src/pro/binance.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export default class binance extends binanceRest {
|
|
|
58
58
|
'ws-api': {
|
|
59
59
|
spot: string;
|
|
60
60
|
future: string;
|
|
61
|
+
delivery: string;
|
|
61
62
|
};
|
|
62
63
|
};
|
|
63
64
|
};
|
|
@@ -70,6 +71,7 @@ export default class binance extends binanceRest {
|
|
|
70
71
|
'ws-api': {
|
|
71
72
|
spot: string;
|
|
72
73
|
future: string;
|
|
74
|
+
delivery: string;
|
|
73
75
|
};
|
|
74
76
|
papi: string;
|
|
75
77
|
};
|
|
@@ -549,6 +551,7 @@ export default class binance extends binanceRest {
|
|
|
549
551
|
* @description fetch balance and get the amount of funds available for trading or funds locked in orders
|
|
550
552
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/websocket-api/Futures-Account-Balance
|
|
551
553
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#account-information-user_data
|
|
554
|
+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/websocket-api
|
|
552
555
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
553
556
|
* @param {string|undefined} [params.type] 'future', 'delivery', 'savings', 'funding', or 'spot'
|
|
554
557
|
* @param {string|undefined} [params.marginMode] 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null
|
|
@@ -574,6 +577,7 @@ export default class binance extends binanceRest {
|
|
|
574
577
|
* @name binance#fetchPositionsWs
|
|
575
578
|
* @description fetch all open positions
|
|
576
579
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Position-Information
|
|
580
|
+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Position-Information
|
|
577
581
|
* @param {string[]} [symbols] list of unified market symbols
|
|
578
582
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
579
583
|
* @param {boolean} [params.returnRateLimits] set to true to return rate limit informations, defaults to false.
|
|
@@ -599,6 +603,7 @@ export default class binance extends binanceRest {
|
|
|
599
603
|
* @description create a trade order
|
|
600
604
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#place-new-order-trade
|
|
601
605
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/New-Order
|
|
606
|
+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api
|
|
602
607
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
603
608
|
* @param {string} type 'market' or 'limit'
|
|
604
609
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -618,6 +623,7 @@ export default class binance extends binanceRest {
|
|
|
618
623
|
* @description edit a trade order
|
|
619
624
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#cancel-and-replace-order-trade
|
|
620
625
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Modify-Order
|
|
626
|
+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Modify-Order
|
|
621
627
|
* @param {string} id order id
|
|
622
628
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
623
629
|
* @param {string} type 'market' or 'limit'
|
|
@@ -635,6 +641,7 @@ export default class binance extends binanceRest {
|
|
|
635
641
|
* @description cancel multiple orders
|
|
636
642
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#cancel-order-trade
|
|
637
643
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Cancel-Order
|
|
644
|
+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Cancel-Order
|
|
638
645
|
* @param {string} id order id
|
|
639
646
|
* @param {string} [symbol] unified market symbol, default is undefined
|
|
640
647
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -658,6 +665,7 @@ export default class binance extends binanceRest {
|
|
|
658
665
|
* @description fetches information on an order made by the user
|
|
659
666
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#query-order-user_data
|
|
660
667
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Query-Order
|
|
668
|
+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Query-Order
|
|
661
669
|
* @param {string} id order id
|
|
662
670
|
* @param {string} [symbol] unified symbol of the market the order was made in
|
|
663
671
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
package/js/src/pro/binance.js
CHANGED
|
@@ -75,6 +75,7 @@ export default class binance extends binanceRest {
|
|
|
75
75
|
'ws-api': {
|
|
76
76
|
'spot': 'wss://testnet.binance.vision/ws-api/v3',
|
|
77
77
|
'future': 'wss://testnet.binancefuture.com/ws-fapi/v1',
|
|
78
|
+
'delivery': 'wss://testnet.binancefuture.com/ws-dapi/v1',
|
|
78
79
|
},
|
|
79
80
|
},
|
|
80
81
|
},
|
|
@@ -87,6 +88,7 @@ export default class binance extends binanceRest {
|
|
|
87
88
|
'ws-api': {
|
|
88
89
|
'spot': 'wss://ws-api.binance.com:443/ws-api/v3',
|
|
89
90
|
'future': 'wss://ws-fapi.binance.com/ws-fapi/v1',
|
|
91
|
+
'delivery': 'wss://ws-dapi.binance.com/ws-dapi/v1',
|
|
90
92
|
},
|
|
91
93
|
'papi': 'wss://fstream.binance.com/pm/ws',
|
|
92
94
|
},
|
|
@@ -2510,6 +2512,7 @@ export default class binance extends binanceRest {
|
|
|
2510
2512
|
* @description fetch balance and get the amount of funds available for trading or funds locked in orders
|
|
2511
2513
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/websocket-api/Futures-Account-Balance
|
|
2512
2514
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#account-information-user_data
|
|
2515
|
+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/websocket-api
|
|
2513
2516
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2514
2517
|
* @param {string|undefined} [params.type] 'future', 'delivery', 'savings', 'funding', or 'spot'
|
|
2515
2518
|
* @param {string|undefined} [params.marginMode] 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null
|
|
@@ -2520,7 +2523,7 @@ export default class binance extends binanceRest {
|
|
|
2520
2523
|
async fetchBalanceWs(params = {}) {
|
|
2521
2524
|
await this.loadMarkets();
|
|
2522
2525
|
const type = this.getMarketType('fetchBalanceWs', undefined, params);
|
|
2523
|
-
if (type !== 'spot' && type !== 'future') {
|
|
2526
|
+
if (type !== 'spot' && type !== 'future' && type !== 'delivery') {
|
|
2524
2527
|
throw new BadRequest(this.id + ' fetchBalanceWs only supports spot or swap markets');
|
|
2525
2528
|
}
|
|
2526
2529
|
const url = this.urls['api']['ws']['ws-api'][type];
|
|
@@ -2629,6 +2632,7 @@ export default class binance extends binanceRest {
|
|
|
2629
2632
|
* @name binance#fetchPositionsWs
|
|
2630
2633
|
* @description fetch all open positions
|
|
2631
2634
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Position-Information
|
|
2635
|
+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Position-Information
|
|
2632
2636
|
* @param {string[]} [symbols] list of unified market symbols
|
|
2633
2637
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2634
2638
|
* @param {boolean} [params.returnRateLimits] set to true to return rate limit informations, defaults to false.
|
|
@@ -2637,17 +2641,23 @@ export default class binance extends binanceRest {
|
|
|
2637
2641
|
*/
|
|
2638
2642
|
async fetchPositionsWs(symbols = undefined, params = {}) {
|
|
2639
2643
|
await this.loadMarkets();
|
|
2640
|
-
symbols = this.marketSymbols(symbols, 'swap', true, true, true);
|
|
2641
|
-
const url = this.urls['api']['ws']['ws-api']['future'];
|
|
2642
|
-
const requestId = this.requestId(url);
|
|
2643
|
-
const messageHash = requestId.toString();
|
|
2644
2644
|
const payload = {};
|
|
2645
|
+
let market = undefined;
|
|
2646
|
+
symbols = this.marketSymbols(symbols, 'swap', true, true, true);
|
|
2645
2647
|
if (symbols !== undefined) {
|
|
2646
2648
|
const symbolsLength = symbols.length;
|
|
2647
2649
|
if (symbolsLength === 1) {
|
|
2648
|
-
|
|
2650
|
+
market = this.market(symbols[0]);
|
|
2651
|
+
payload['symbol'] = market['id'];
|
|
2649
2652
|
}
|
|
2650
2653
|
}
|
|
2654
|
+
const type = this.getMarketType('fetchPositionsWs', market, params);
|
|
2655
|
+
if (type !== 'future' && type !== 'delivery') {
|
|
2656
|
+
throw new BadRequest(this.id + ' fetchPositionsWs only supports swap markets');
|
|
2657
|
+
}
|
|
2658
|
+
const url = this.urls['api']['ws']['ws-api'][type];
|
|
2659
|
+
const requestId = this.requestId(url);
|
|
2660
|
+
const messageHash = requestId.toString();
|
|
2651
2661
|
let returnRateLimits = false;
|
|
2652
2662
|
[returnRateLimits, params] = this.handleOptionAndParams(params, 'fetchPositionsWs', 'returnRateLimits', false);
|
|
2653
2663
|
payload['returnRateLimits'] = returnRateLimits;
|
|
@@ -2873,6 +2883,7 @@ export default class binance extends binanceRest {
|
|
|
2873
2883
|
* @description create a trade order
|
|
2874
2884
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#place-new-order-trade
|
|
2875
2885
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/New-Order
|
|
2886
|
+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api
|
|
2876
2887
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2877
2888
|
* @param {string} type 'market' or 'limit'
|
|
2878
2889
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -2887,7 +2898,7 @@ export default class binance extends binanceRest {
|
|
|
2887
2898
|
await this.loadMarkets();
|
|
2888
2899
|
const market = this.market(symbol);
|
|
2889
2900
|
const marketType = this.getMarketType('createOrderWs', market, params);
|
|
2890
|
-
if (marketType !== 'spot' && marketType !== 'future') {
|
|
2901
|
+
if (marketType !== 'spot' && marketType !== 'future' && marketType !== 'delivery') {
|
|
2891
2902
|
throw new BadRequest(this.id + ' createOrderWs only supports spot or swap markets');
|
|
2892
2903
|
}
|
|
2893
2904
|
const url = this.urls['api']['ws']['ws-api'][marketType];
|
|
@@ -3021,6 +3032,7 @@ export default class binance extends binanceRest {
|
|
|
3021
3032
|
* @description edit a trade order
|
|
3022
3033
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#cancel-and-replace-order-trade
|
|
3023
3034
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Modify-Order
|
|
3035
|
+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Modify-Order
|
|
3024
3036
|
* @param {string} id order id
|
|
3025
3037
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
3026
3038
|
* @param {string} type 'market' or 'limit'
|
|
@@ -3034,17 +3046,18 @@ export default class binance extends binanceRest {
|
|
|
3034
3046
|
await this.loadMarkets();
|
|
3035
3047
|
const market = this.market(symbol);
|
|
3036
3048
|
const marketType = this.getMarketType('editOrderWs', market, params);
|
|
3037
|
-
if (marketType !== 'spot' && marketType !== 'future') {
|
|
3049
|
+
if (marketType !== 'spot' && marketType !== 'future' && marketType !== 'delivery') {
|
|
3038
3050
|
throw new BadRequest(this.id + ' editOrderWs only supports spot or swap markets');
|
|
3039
3051
|
}
|
|
3040
3052
|
const url = this.urls['api']['ws']['ws-api'][marketType];
|
|
3041
3053
|
const requestId = this.requestId(url);
|
|
3042
3054
|
const messageHash = requestId.toString();
|
|
3055
|
+
const isSwap = (marketType === 'future' || marketType === 'delivery');
|
|
3043
3056
|
let payload = undefined;
|
|
3044
3057
|
if (marketType === 'spot') {
|
|
3045
3058
|
payload = this.editSpotOrderRequest(id, symbol, type, side, amount, price, params);
|
|
3046
3059
|
}
|
|
3047
|
-
else if (
|
|
3060
|
+
else if (isSwap) {
|
|
3048
3061
|
payload = this.editContractOrderRequest(id, symbol, type, side, amount, price, params);
|
|
3049
3062
|
}
|
|
3050
3063
|
let returnRateLimits = false;
|
|
@@ -3052,7 +3065,7 @@ export default class binance extends binanceRest {
|
|
|
3052
3065
|
payload['returnRateLimits'] = returnRateLimits;
|
|
3053
3066
|
const message = {
|
|
3054
3067
|
'id': messageHash,
|
|
3055
|
-
'method': (
|
|
3068
|
+
'method': (isSwap) ? 'order.modify' : 'order.cancelReplace',
|
|
3056
3069
|
'params': this.signParams(this.extend(payload, params)),
|
|
3057
3070
|
};
|
|
3058
3071
|
const subscription = {
|
|
@@ -3177,6 +3190,7 @@ export default class binance extends binanceRest {
|
|
|
3177
3190
|
* @description cancel multiple orders
|
|
3178
3191
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#cancel-order-trade
|
|
3179
3192
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Cancel-Order
|
|
3193
|
+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Cancel-Order
|
|
3180
3194
|
* @param {string} id order id
|
|
3181
3195
|
* @param {string} [symbol] unified market symbol, default is undefined
|
|
3182
3196
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -3258,6 +3272,7 @@ export default class binance extends binanceRest {
|
|
|
3258
3272
|
* @description fetches information on an order made by the user
|
|
3259
3273
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#query-order-user_data
|
|
3260
3274
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Query-Order
|
|
3275
|
+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/websocket-api/Query-Order
|
|
3261
3276
|
* @param {string} id order id
|
|
3262
3277
|
* @param {string} [symbol] unified symbol of the market the order was made in
|
|
3263
3278
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -3270,7 +3285,7 @@ export default class binance extends binanceRest {
|
|
|
3270
3285
|
}
|
|
3271
3286
|
const market = this.market(symbol);
|
|
3272
3287
|
const type = this.getMarketType('fetchOrderWs', market, params);
|
|
3273
|
-
if (type !== 'spot' && type !== 'future') {
|
|
3288
|
+
if (type !== 'spot' && type !== 'future' && type !== 'delivery') {
|
|
3274
3289
|
throw new BadRequest(this.id + ' fetchOrderWs only supports spot or swap markets');
|
|
3275
3290
|
}
|
|
3276
3291
|
const url = this.urls['api']['ws']['ws-api'][type];
|
package/js/src/pro/lbank.js
CHANGED
|
@@ -430,7 +430,7 @@ export default class lbank extends lbankRest {
|
|
|
430
430
|
// "volume":6.3607,
|
|
431
431
|
// "amount":77148.9303,
|
|
432
432
|
// "price":12129,
|
|
433
|
-
// "direction":"sell", //
|
|
433
|
+
// "direction":"sell", // buy, sell, buy_market, sell_market, buy_maker, sell_maker, buy_ioc, sell_ioc, buy_fok, sell_fok
|
|
434
434
|
// "TS":"2019-06-28T19:55:49.460"
|
|
435
435
|
// },
|
|
436
436
|
// "type":"trade",
|
|
@@ -470,7 +470,7 @@ export default class lbank extends lbankRest {
|
|
|
470
470
|
// "volume":6.3607,
|
|
471
471
|
// "amount":77148.9303,
|
|
472
472
|
// "price":12129,
|
|
473
|
-
// "direction":"sell", //
|
|
473
|
+
// "direction":"sell", // buy, sell, buy_market, sell_market, buy_maker, sell_maker, buy_ioc, sell_ioc, buy_fok, sell_fok
|
|
474
474
|
// "TS":"2019-06-28T19:55:49.460"
|
|
475
475
|
// }
|
|
476
476
|
//
|
|
@@ -479,8 +479,15 @@ export default class lbank extends lbankRest {
|
|
|
479
479
|
if (timestamp === undefined) {
|
|
480
480
|
timestamp = this.parse8601(datetime);
|
|
481
481
|
}
|
|
482
|
-
|
|
483
|
-
|
|
482
|
+
const rawSide = this.safeString2(trade, 'direction', 3);
|
|
483
|
+
const parts = rawSide.split('_');
|
|
484
|
+
const firstPart = this.safeString(parts, 0);
|
|
485
|
+
const secondPart = this.safeString(parts, 1);
|
|
486
|
+
let side = firstPart;
|
|
487
|
+
// reverse if it was 'maker'
|
|
488
|
+
if (secondPart !== undefined && secondPart === 'maker') {
|
|
489
|
+
side = (side === 'buy') ? 'sell' : 'buy';
|
|
490
|
+
}
|
|
484
491
|
return this.safeTrade({
|
|
485
492
|
'timestamp': timestamp,
|
|
486
493
|
'datetime': datetime,
|
package/js/src/pro/myokx.js
CHANGED
|
@@ -11,11 +11,20 @@ export default class myokx extends okx {
|
|
|
11
11
|
describe() {
|
|
12
12
|
return this.deepExtend(super.describe(), {
|
|
13
13
|
'id': 'myokx',
|
|
14
|
-
'name': 'MyOKX',
|
|
14
|
+
'name': 'MyOKX (EEA)',
|
|
15
|
+
'hostname': 'eea.okx.com',
|
|
15
16
|
'urls': {
|
|
16
17
|
'api': {
|
|
18
|
+
'rest': 'https://{hostname}',
|
|
17
19
|
'ws': 'wss://wseea.okx.com:8443/ws/v5',
|
|
18
20
|
},
|
|
21
|
+
'www': 'https://my.okx.com',
|
|
22
|
+
'doc': 'https://my.okx.com/docs-v5/en/#overview',
|
|
23
|
+
'fees': 'https://my.okx.com/pages/products/fees.html',
|
|
24
|
+
'referral': {
|
|
25
|
+
'url': 'https://www.my.okx.com/join/CCXT2023',
|
|
26
|
+
'discount': 0.2,
|
|
27
|
+
},
|
|
19
28
|
'test': {
|
|
20
29
|
'ws': 'wss://wseeapap.okx.com:8443/ws/v5',
|
|
21
30
|
},
|
package/js/src/whitebit.js
CHANGED
|
@@ -1161,6 +1161,7 @@ export default class whitebit extends Exchange {
|
|
|
1161
1161
|
// "clientOrderId": "customId11",
|
|
1162
1162
|
// "role": 2, // 1 = maker, 2 = taker
|
|
1163
1163
|
// "deal": "0.00419198" // amount in money
|
|
1164
|
+
// "feeAsset": "USDT"
|
|
1164
1165
|
// }
|
|
1165
1166
|
//
|
|
1166
1167
|
// fetchMyTrades
|
|
@@ -1176,6 +1177,7 @@ export default class whitebit extends Exchange {
|
|
|
1176
1177
|
// "deal": "9.981007",
|
|
1177
1178
|
// "fee": "0.009981007",
|
|
1178
1179
|
// "orderId": 58166729555,
|
|
1180
|
+
// "feeAsset": "USDT"
|
|
1179
1181
|
// }
|
|
1180
1182
|
//
|
|
1181
1183
|
market = this.safeMarket(undefined, market);
|
|
@@ -1197,7 +1199,7 @@ export default class whitebit extends Exchange {
|
|
|
1197
1199
|
if (feeCost !== undefined) {
|
|
1198
1200
|
fee = {
|
|
1199
1201
|
'cost': feeCost,
|
|
1200
|
-
'currency':
|
|
1202
|
+
'currency': this.safeCurrencyCode(this.safeString(trade, 'feeAsset')),
|
|
1201
1203
|
};
|
|
1202
1204
|
}
|
|
1203
1205
|
return this.safeTrade({
|