ccxt 4.2.92 → 4.2.94
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/build.sh +1 -1
- package/dist/ccxt.browser.js +807 -175
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +50 -9
- package/dist/cjs/src/base/functions/encode.js +4 -4
- package/dist/cjs/src/binance.js +63 -2
- package/dist/cjs/src/bitget.js +139 -0
- package/dist/cjs/src/coinex.js +0 -30
- package/dist/cjs/src/digifinex.js +1 -22
- package/dist/cjs/src/okx.js +153 -0
- package/dist/cjs/src/pro/kraken.js +107 -17
- package/dist/cjs/src/pro/krakenfutures.js +117 -40
- package/dist/cjs/src/pro/kucoin.js +30 -19
- package/dist/cjs/src/probit.js +3 -4
- package/dist/cjs/src/woo.js +139 -0
- package/examples/js/cli.js +4 -1
- package/examples/ts/cli.ts +4 -1
- package/js/ccxt.d.ts +3 -3
- package/js/ccxt.js +1 -1
- 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/base/Exchange.d.ts +16 -10
- package/js/src/base/Exchange.js +50 -9
- package/js/src/base/functions/encode.d.ts +1 -1
- package/js/src/base/functions/encode.js +4 -4
- package/js/src/base/functions/rsa.d.ts +1 -1
- package/js/src/base/types.d.ts +12 -0
- package/js/src/binance.d.ts +1 -0
- package/js/src/binance.js +63 -2
- package/js/src/bitget.d.ts +4 -1
- package/js/src/bitget.js +139 -0
- package/js/src/coinex.d.ts +0 -1
- package/js/src/coinex.js +0 -30
- package/js/src/digifinex.d.ts +0 -1
- package/js/src/digifinex.js +1 -49
- package/js/src/okx.d.ts +4 -1
- package/js/src/okx.js +153 -0
- package/js/src/pro/kraken.d.ts +6 -1
- package/js/src/pro/kraken.js +107 -17
- package/js/src/pro/krakenfutures.d.ts +8 -2
- package/js/src/pro/krakenfutures.js +117 -40
- package/js/src/pro/kucoin.js +30 -19
- package/js/src/probit.d.ts +1 -1
- package/js/src/probit.js +3 -4
- package/js/src/woo.d.ts +4 -1
- package/js/src/woo.js +139 -0
- package/package.json +1 -1
- package/skip-tests.json +4 -0
package/dist/cjs/src/woo.js
CHANGED
|
@@ -57,6 +57,8 @@ class woo extends woo$1 {
|
|
|
57
57
|
'fetchCanceledOrders': false,
|
|
58
58
|
'fetchClosedOrder': false,
|
|
59
59
|
'fetchClosedOrders': true,
|
|
60
|
+
'fetchConvertCurrencies': true,
|
|
61
|
+
'fetchConvertQuote': true,
|
|
60
62
|
'fetchCurrencies': true,
|
|
61
63
|
'fetchDepositAddress': true,
|
|
62
64
|
'fetchDeposits': true,
|
|
@@ -2985,6 +2987,143 @@ class woo extends woo$1 {
|
|
|
2985
2987
|
'takeProfitPrice': undefined,
|
|
2986
2988
|
});
|
|
2987
2989
|
}
|
|
2990
|
+
async fetchConvertQuote(fromCode, toCode, amount = undefined, params = {}) {
|
|
2991
|
+
/**
|
|
2992
|
+
* @method
|
|
2993
|
+
* @name woo#fetchConvertQuote
|
|
2994
|
+
* @description fetch a quote for converting from one currency to another
|
|
2995
|
+
* @see https://docs.woo.org/#get-quote-rfq
|
|
2996
|
+
* @param {string} fromCode the currency that you want to sell and convert from
|
|
2997
|
+
* @param {string} toCode the currency that you want to buy and convert into
|
|
2998
|
+
* @param {float} [amount] how much you want to trade in units of the from currency
|
|
2999
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3000
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
3001
|
+
*/
|
|
3002
|
+
await this.loadMarkets();
|
|
3003
|
+
const request = {
|
|
3004
|
+
'sellToken': fromCode.toUpperCase(),
|
|
3005
|
+
'buyToken': toCode.toUpperCase(),
|
|
3006
|
+
'sellQuantity': this.numberToString(amount),
|
|
3007
|
+
};
|
|
3008
|
+
const response = await this.v3PrivateGetConvertRfq(this.extend(request, params));
|
|
3009
|
+
//
|
|
3010
|
+
// {
|
|
3011
|
+
// "success": true,
|
|
3012
|
+
// "data": {
|
|
3013
|
+
// "quoteId": 123123123,
|
|
3014
|
+
// "counterPartyId": "",
|
|
3015
|
+
// "sellToken": "ETH",
|
|
3016
|
+
// "sellQuantity": "0.0445",
|
|
3017
|
+
// "buyToken": "USDT",
|
|
3018
|
+
// "buyQuantity": "33.45",
|
|
3019
|
+
// "buyPrice": "6.77",
|
|
3020
|
+
// "expireTimestamp": 1659084466000,
|
|
3021
|
+
// "message": 1659084466000
|
|
3022
|
+
// }
|
|
3023
|
+
// }
|
|
3024
|
+
//
|
|
3025
|
+
const data = this.safeDict(response, 'data', {});
|
|
3026
|
+
const fromCurrencyId = this.safeString(data, 'sellToken', fromCode);
|
|
3027
|
+
const fromCurrency = this.currency(fromCurrencyId);
|
|
3028
|
+
const toCurrencyId = this.safeString(data, 'buyToken', toCode);
|
|
3029
|
+
const toCurrency = this.currency(toCurrencyId);
|
|
3030
|
+
return this.parseConversion(data, fromCurrency, toCurrency);
|
|
3031
|
+
}
|
|
3032
|
+
parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
|
|
3033
|
+
//
|
|
3034
|
+
// fetchConvertQuote
|
|
3035
|
+
//
|
|
3036
|
+
// {
|
|
3037
|
+
// "quoteId": 123123123,
|
|
3038
|
+
// "counterPartyId": "",
|
|
3039
|
+
// "sellToken": "ETH",
|
|
3040
|
+
// "sellQuantity": "0.0445",
|
|
3041
|
+
// "buyToken": "USDT",
|
|
3042
|
+
// "buyQuantity": "33.45",
|
|
3043
|
+
// "buyPrice": "6.77",
|
|
3044
|
+
// "expireTimestamp": 1659084466000,
|
|
3045
|
+
// "message": 1659084466000
|
|
3046
|
+
// }
|
|
3047
|
+
//
|
|
3048
|
+
const timestamp = this.safeInteger(conversion, 'expireTimestamp');
|
|
3049
|
+
const fromCoin = this.safeString(conversion, 'sellToken');
|
|
3050
|
+
const fromCode = this.safeCurrencyCode(fromCoin, fromCurrency);
|
|
3051
|
+
const to = this.safeString(conversion, 'buyToken');
|
|
3052
|
+
const toCode = this.safeCurrencyCode(to, toCurrency);
|
|
3053
|
+
return {
|
|
3054
|
+
'info': conversion,
|
|
3055
|
+
'timestamp': timestamp,
|
|
3056
|
+
'datetime': this.iso8601(timestamp),
|
|
3057
|
+
'id': this.safeString(conversion, 'quoteId'),
|
|
3058
|
+
'fromCurrency': fromCode,
|
|
3059
|
+
'fromAmount': this.safeNumber(conversion, 'sellQuantity'),
|
|
3060
|
+
'toCurrency': toCode,
|
|
3061
|
+
'toAmount': this.safeNumber(conversion, 'buyQuantity'),
|
|
3062
|
+
'price': this.safeNumber(conversion, 'buyPrice'),
|
|
3063
|
+
'fee': undefined,
|
|
3064
|
+
};
|
|
3065
|
+
}
|
|
3066
|
+
async fetchConvertCurrencies(params = {}) {
|
|
3067
|
+
/**
|
|
3068
|
+
* @method
|
|
3069
|
+
* @name woo#fetchConvertCurrencies
|
|
3070
|
+
* @description fetches all available currencies that can be converted
|
|
3071
|
+
* @see https://docs.woo.org/#get-quote-asset-info
|
|
3072
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3073
|
+
* @returns {object} an associative dictionary of currencies
|
|
3074
|
+
*/
|
|
3075
|
+
await this.loadMarkets();
|
|
3076
|
+
const response = await this.v3PrivateGetConvertAssetInfo(params);
|
|
3077
|
+
//
|
|
3078
|
+
// {
|
|
3079
|
+
// "success": true,
|
|
3080
|
+
// "rows": [
|
|
3081
|
+
// {
|
|
3082
|
+
// "token": "BTC",
|
|
3083
|
+
// "tick": 0.0001,
|
|
3084
|
+
// "createdTime": "1575014248.99", // Unix epoch time in seconds
|
|
3085
|
+
// "updatedTime": "1575014248.99" // Unix epoch time in seconds
|
|
3086
|
+
// },
|
|
3087
|
+
// ]
|
|
3088
|
+
// }
|
|
3089
|
+
//
|
|
3090
|
+
const result = {};
|
|
3091
|
+
const data = this.safeList(response, 'rows', []);
|
|
3092
|
+
for (let i = 0; i < data.length; i++) {
|
|
3093
|
+
const entry = data[i];
|
|
3094
|
+
const id = this.safeString(entry, 'token');
|
|
3095
|
+
const code = this.safeCurrencyCode(id);
|
|
3096
|
+
result[code] = {
|
|
3097
|
+
'info': entry,
|
|
3098
|
+
'id': id,
|
|
3099
|
+
'code': code,
|
|
3100
|
+
'networks': undefined,
|
|
3101
|
+
'type': undefined,
|
|
3102
|
+
'name': undefined,
|
|
3103
|
+
'active': undefined,
|
|
3104
|
+
'deposit': undefined,
|
|
3105
|
+
'withdraw': undefined,
|
|
3106
|
+
'fee': undefined,
|
|
3107
|
+
'precision': this.safeNumber(entry, 'tick'),
|
|
3108
|
+
'limits': {
|
|
3109
|
+
'amount': {
|
|
3110
|
+
'min': undefined,
|
|
3111
|
+
'max': undefined,
|
|
3112
|
+
},
|
|
3113
|
+
'withdraw': {
|
|
3114
|
+
'min': undefined,
|
|
3115
|
+
'max': undefined,
|
|
3116
|
+
},
|
|
3117
|
+
'deposit': {
|
|
3118
|
+
'min': undefined,
|
|
3119
|
+
'max': undefined,
|
|
3120
|
+
},
|
|
3121
|
+
},
|
|
3122
|
+
'created': this.safeTimestamp(entry, 'createdTime'),
|
|
3123
|
+
};
|
|
3124
|
+
}
|
|
3125
|
+
return result;
|
|
3126
|
+
}
|
|
2988
3127
|
defaultNetworkCodeForCurrency(code) {
|
|
2989
3128
|
const currencyItem = this.currency(code);
|
|
2990
3129
|
const networks = currencyItem['networks'];
|
package/examples/js/cli.js
CHANGED
|
@@ -112,8 +112,11 @@ try {
|
|
|
112
112
|
for (const [credential, isRequired] of Object.entries (requiredCredentials)) {
|
|
113
113
|
if (isRequired && exchange[credential] === undefined) {
|
|
114
114
|
const credentialEnvName = (exchangeId + '_' + credential).toUpperCase () // example: KRAKEN_APIKEY
|
|
115
|
-
|
|
115
|
+
let credentialValue = process.env[credentialEnvName]
|
|
116
116
|
if (credentialValue) {
|
|
117
|
+
if (credentialValue.indexOf('---BEGIN') > -1) {
|
|
118
|
+
credentialValue = credentialValue.replaceAll('\\n', '\n');
|
|
119
|
+
}
|
|
117
120
|
exchange[credential] = credentialValue
|
|
118
121
|
}
|
|
119
122
|
}
|
package/examples/ts/cli.ts
CHANGED
|
@@ -109,8 +109,11 @@ try {
|
|
|
109
109
|
for (const [credential, isRequired] of Object.entries (requiredCredentials)) {
|
|
110
110
|
if (isRequired && exchange[credential] === undefined) {
|
|
111
111
|
const credentialEnvName = (exchangeId + '_' + credential).toUpperCase () // example: KRAKEN_APIKEY
|
|
112
|
-
|
|
112
|
+
let credentialValue = process.env[credentialEnvName]
|
|
113
113
|
if (credentialValue) {
|
|
114
|
+
if (credentialValue.indexOf('---BEGIN') > -1) {
|
|
115
|
+
credentialValue = (credentialValue as any).replaceAll('\\n', '\n');
|
|
116
|
+
}
|
|
114
117
|
exchange[credential] = credentialValue
|
|
115
118
|
}
|
|
116
119
|
}
|
package/js/ccxt.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { Exchange } from './src/base/Exchange.js';
|
|
|
2
2
|
import { Precise } from './src/base/Precise.js';
|
|
3
3
|
import * as functions from './src/base/functions.js';
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
|
-
import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain } from './src/base/types.js';
|
|
5
|
+
import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain, Conversion } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, ExchangeClosedByUser } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.2.
|
|
7
|
+
declare const version = "4.2.93";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
|
@@ -519,5 +519,5 @@ declare const ccxt: {
|
|
|
519
519
|
zaif: typeof zaif;
|
|
520
520
|
zonda: typeof zonda;
|
|
521
521
|
} & typeof functions & typeof errors;
|
|
522
|
-
export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, ExchangeClosedByUser, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseinternational, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, tradeogre, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
|
|
522
|
+
export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, ExchangeClosedByUser, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain, Conversion, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseinternational, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, tradeogre, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
|
|
523
523
|
export default ccxt;
|
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, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, ExchangeClosedByUser } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.2.
|
|
41
|
+
const version = '4.2.94';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -607,6 +607,7 @@ interface Exchange {
|
|
|
607
607
|
privateGetMyAllocations(params?: {}): Promise<implicitReturnType>;
|
|
608
608
|
privateGetAccountCommission(params?: {}): Promise<implicitReturnType>;
|
|
609
609
|
privatePostOrderOco(params?: {}): Promise<implicitReturnType>;
|
|
610
|
+
privatePostOrderListOco(params?: {}): Promise<implicitReturnType>;
|
|
610
611
|
privatePostSorOrder(params?: {}): Promise<implicitReturnType>;
|
|
611
612
|
privatePostSorOrderTest(params?: {}): Promise<implicitReturnType>;
|
|
612
613
|
privatePostOrder(params?: {}): Promise<implicitReturnType>;
|
|
@@ -607,6 +607,7 @@ interface binance {
|
|
|
607
607
|
privateGetMyAllocations(params?: {}): Promise<implicitReturnType>;
|
|
608
608
|
privateGetAccountCommission(params?: {}): Promise<implicitReturnType>;
|
|
609
609
|
privatePostOrderOco(params?: {}): Promise<implicitReturnType>;
|
|
610
|
+
privatePostOrderListOco(params?: {}): Promise<implicitReturnType>;
|
|
610
611
|
privatePostSorOrder(params?: {}): Promise<implicitReturnType>;
|
|
611
612
|
privatePostSorOrderTest(params?: {}): Promise<implicitReturnType>;
|
|
612
613
|
privatePostOrder(params?: {}): Promise<implicitReturnType>;
|
|
@@ -659,6 +659,7 @@ interface binance {
|
|
|
659
659
|
privateGetMyAllocations(params?: {}): Promise<implicitReturnType>;
|
|
660
660
|
privateGetAccountCommission(params?: {}): Promise<implicitReturnType>;
|
|
661
661
|
privatePostOrderOco(params?: {}): Promise<implicitReturnType>;
|
|
662
|
+
privatePostOrderListOco(params?: {}): Promise<implicitReturnType>;
|
|
662
663
|
privatePostSorOrder(params?: {}): Promise<implicitReturnType>;
|
|
663
664
|
privatePostSorOrderTest(params?: {}): Promise<implicitReturnType>;
|
|
664
665
|
privatePostOrder(params?: {}): Promise<implicitReturnType>;
|
|
@@ -607,6 +607,7 @@ interface binance {
|
|
|
607
607
|
privateGetMyAllocations(params?: {}): Promise<implicitReturnType>;
|
|
608
608
|
privateGetAccountCommission(params?: {}): Promise<implicitReturnType>;
|
|
609
609
|
privatePostOrderOco(params?: {}): Promise<implicitReturnType>;
|
|
610
|
+
privatePostOrderListOco(params?: {}): Promise<implicitReturnType>;
|
|
610
611
|
privatePostSorOrder(params?: {}): Promise<implicitReturnType>;
|
|
611
612
|
privatePostSorOrderTest(params?: {}): Promise<implicitReturnType>;
|
|
612
613
|
privatePostOrder(params?: {}): Promise<implicitReturnType>;
|
|
@@ -3,8 +3,8 @@ import { // eslint-disable-line object-curly-newline
|
|
|
3
3
|
ExchangeError, AuthenticationError, DDoSProtection, RequestTimeout, ExchangeNotAvailable, RateLimitExceeded } from "./errors.js";
|
|
4
4
|
import WsClient from './ws/WsClient.js';
|
|
5
5
|
import { OrderBook as WsOrderBook, IndexedOrderBook, CountedOrderBook } from './ws/OrderBook.js';
|
|
6
|
-
import type { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRate, DepositWithdrawFeeNetwork, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings, MarginModification, TradingFeeInterface, Currencies, TradingFees } from './types.js';
|
|
7
|
-
export type { Market, Trade, Fee, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, BorrowRate, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings } from './types.js';
|
|
6
|
+
import type { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRate, DepositWithdrawFeeNetwork, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion } from './types.js';
|
|
7
|
+
export type { Market, Trade, Fee, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, BorrowRate, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings, Conversion } from './types.js';
|
|
8
8
|
import { ArrayCache, ArrayCacheByTimestamp } from './ws/Cache.js';
|
|
9
9
|
import { OrderBook as Ob } from './ws/OrderBook.js';
|
|
10
10
|
/**
|
|
@@ -219,7 +219,7 @@ export default class Exchange {
|
|
|
219
219
|
}, digest?: "binary" | "hex" | "base64") => any;
|
|
220
220
|
arrayConcat: (a: any, b: any) => any;
|
|
221
221
|
encode: (str: string) => Uint8Array;
|
|
222
|
-
urlencode: (object:
|
|
222
|
+
urlencode: (object: object) => string;
|
|
223
223
|
hmac: (request: import("../static_dependencies/noble-hashes/utils.js").Input, secret: import("../static_dependencies/noble-hashes/utils.js").Input, hash: {
|
|
224
224
|
(message: import("../static_dependencies/noble-hashes/utils.js").Input): Uint8Array;
|
|
225
225
|
outputLen: number;
|
|
@@ -234,12 +234,12 @@ export default class Exchange {
|
|
|
234
234
|
yyyymmdd: (timestamp: any, infix?: string) => string;
|
|
235
235
|
safeStringUpper: (o: any, k: IndexType, $default?: string) => string;
|
|
236
236
|
safeTimestamp: (o: any, k: IndexType, $default?: number) => number;
|
|
237
|
-
binaryConcatArray: (arr: any) => Uint8Array;
|
|
237
|
+
binaryConcatArray: (arr: any[]) => Uint8Array;
|
|
238
238
|
uuidv1: () => string;
|
|
239
239
|
numberToLE: (n: number, padding: number) => Uint8Array;
|
|
240
240
|
ymdhms: (timestamp: any, infix?: string) => string;
|
|
241
241
|
yymmdd: (timestamp: any, infix?: string) => string;
|
|
242
|
-
stringToBase64: (string:
|
|
242
|
+
stringToBase64: (string: string) => string;
|
|
243
243
|
decode: (data: Uint8Array) => string;
|
|
244
244
|
uuid22: (a?: any) => string;
|
|
245
245
|
safeIntegerProduct2: (o: any, k1: IndexType, k2: IndexType, $factor: number, $default?: number) => number;
|
|
@@ -248,7 +248,7 @@ export default class Exchange {
|
|
|
248
248
|
base58ToBinary: (str: string) => Uint8Array;
|
|
249
249
|
base64ToBinary: (str: string) => Uint8Array;
|
|
250
250
|
safeTimestamp2: (o: any, k1: IndexType, k2: IndexType, $default?: any) => number;
|
|
251
|
-
rawencode: (object:
|
|
251
|
+
rawencode: (object: object) => string;
|
|
252
252
|
keysort: (x: any, out?: {}) => {};
|
|
253
253
|
inArray: (needle: any, haystack: any) => any;
|
|
254
254
|
safeStringLower2: (o: any, k1: IndexType, k2: IndexType, $default?: string) => string;
|
|
@@ -257,7 +257,7 @@ export default class Exchange {
|
|
|
257
257
|
ordered: (x: any) => any;
|
|
258
258
|
filterBy: (x: any, k: any, value?: any, out?: any[]) => any[];
|
|
259
259
|
uuid16: (a?: any) => string;
|
|
260
|
-
urlencodeWithArrayRepeat: (object:
|
|
260
|
+
urlencodeWithArrayRepeat: (object: object) => string;
|
|
261
261
|
microseconds: () => number;
|
|
262
262
|
binaryToBase64: (data: Uint8Array) => string;
|
|
263
263
|
strip: (s: string) => string;
|
|
@@ -270,10 +270,10 @@ export default class Exchange {
|
|
|
270
270
|
safeStringN: (o: any, k: IndexType[], $default?: string) => string;
|
|
271
271
|
safeStringLowerN: (o: any, k: IndexType[], $default?: string) => string;
|
|
272
272
|
safeStringUpperN: (o: any, k: IndexType[], $default?: string) => string;
|
|
273
|
-
urlencodeNested: (object:
|
|
273
|
+
urlencodeNested: (object: object) => string;
|
|
274
274
|
parseDate: (x: any) => number;
|
|
275
275
|
ymd: (timestamp: any, infix: any, fullYear?: boolean) => string;
|
|
276
|
-
base64ToString: (string:
|
|
276
|
+
base64ToString: (string: string) => string;
|
|
277
277
|
crc32: typeof functions.crc32;
|
|
278
278
|
packb: typeof functions.packb;
|
|
279
279
|
describe(): {
|
|
@@ -348,6 +348,8 @@ export default class Exchange {
|
|
|
348
348
|
fetchClosedOrder: any;
|
|
349
349
|
fetchClosedOrders: any;
|
|
350
350
|
fetchClosedOrdersWs: any;
|
|
351
|
+
fetchConvertCurrencies: any;
|
|
352
|
+
fetchConvertQuote: any;
|
|
351
353
|
fetchCrossBorrowRate: any;
|
|
352
354
|
fetchCrossBorrowRates: any;
|
|
353
355
|
fetchCurrencies: string;
|
|
@@ -776,6 +778,7 @@ export default class Exchange {
|
|
|
776
778
|
convertOHLCVToTradingView(ohlcvs: number[][], timestamp?: string, open?: string, high?: string, low?: string, close?: string, volume?: string, ms?: boolean): {};
|
|
777
779
|
fetchWebEndpoint(method: any, endpointMethod: any, returnAsJson: any, startRegex?: any, endRegex?: any): Promise<any>;
|
|
778
780
|
marketIds(symbols?: Strings): any[];
|
|
781
|
+
marketsForSymbols(symbols?: Strings): any[];
|
|
779
782
|
marketSymbols(symbols?: Strings, type?: Str, allowEmpty?: boolean, sameTypeOnly?: boolean, sameSubTypeOnly?: boolean): any[];
|
|
780
783
|
marketCodes(codes?: Strings): any[];
|
|
781
784
|
parseBidsAsks(bidasks: any, priceKey?: IndexType, amountKey?: IndexType, countOrIdKey?: IndexType): any[];
|
|
@@ -792,7 +795,7 @@ export default class Exchange {
|
|
|
792
795
|
safeNumber2(dictionary: object, key1: IndexType, key2: IndexType, d?: any): number;
|
|
793
796
|
parseOrderBook(orderbook: object, symbol: string, timestamp?: Int, bidsKey?: string, asksKey?: string, priceKey?: IndexType, amountKey?: IndexType, countOrIdKey?: IndexType): OrderBook;
|
|
794
797
|
parseOHLCVs(ohlcvs: object[], market?: any, timeframe?: string, since?: Int, limit?: Int): OHLCV[];
|
|
795
|
-
parseLeverageTiers(response:
|
|
798
|
+
parseLeverageTiers(response: any, symbols?: string[], marketIdKey?: any): {};
|
|
796
799
|
loadTradingLimits(symbols?: string[], reload?: boolean, params?: {}): Promise<Dictionary<any>>;
|
|
797
800
|
safePosition(position: any): Position;
|
|
798
801
|
parsePositions(positions: any[], symbols?: string[], params?: {}): Position[];
|
|
@@ -910,6 +913,7 @@ export default class Exchange {
|
|
|
910
913
|
fetchGreeks(symbol: string, params?: {}): Promise<Greeks>;
|
|
911
914
|
fetchOptionChain(code: string, params?: {}): Promise<OptionChain>;
|
|
912
915
|
fetchOption(symbol: string, params?: {}): Promise<Option>;
|
|
916
|
+
fetchConvertQuote(fromCode: string, toCode: string, amount?: Num, params?: {}): Promise<Conversion>;
|
|
913
917
|
fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
914
918
|
fetchDeposits(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
915
919
|
fetchWithdrawals(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
@@ -974,6 +978,7 @@ export default class Exchange {
|
|
|
974
978
|
fetchTradingFees(params?: {}): Promise<TradingFees>;
|
|
975
979
|
fetchTradingFeesWs(params?: {}): Promise<TradingFees>;
|
|
976
980
|
fetchTradingFee(symbol: string, params?: {}): Promise<TradingFeeInterface>;
|
|
981
|
+
fetchConvertCurrencies(params?: {}): Promise<Currencies>;
|
|
977
982
|
parseOpenInterest(interest: any, market?: Market): OpenInterest;
|
|
978
983
|
parseOpenInterests(response: any, market?: any, since?: Int, limit?: Int): OpenInterest[];
|
|
979
984
|
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
@@ -1015,6 +1020,7 @@ export default class Exchange {
|
|
|
1015
1020
|
parseMarginMode(marginMode: any, market?: Market): MarginMode;
|
|
1016
1021
|
parseLeverages(response: object[], symbols?: string[], symbolKey?: Str, marketType?: MarketType): Leverages;
|
|
1017
1022
|
parseLeverage(leverage: any, market?: Market): Leverage;
|
|
1023
|
+
parseConversion(conversion: any, fromCurrency?: Currency, toCurrency?: Currency): Conversion;
|
|
1018
1024
|
convertExpireDate(date: string): string;
|
|
1019
1025
|
convertExpireDateToMarketIdDate(date: string): string;
|
|
1020
1026
|
convertMarketIdExpireDate(date: string): string;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -406,6 +406,8 @@ export default class Exchange {
|
|
|
406
406
|
'fetchClosedOrder': undefined,
|
|
407
407
|
'fetchClosedOrders': undefined,
|
|
408
408
|
'fetchClosedOrdersWs': undefined,
|
|
409
|
+
'fetchConvertCurrencies': undefined,
|
|
410
|
+
'fetchConvertQuote': undefined,
|
|
409
411
|
'fetchCrossBorrowRate': undefined,
|
|
410
412
|
'fetchCrossBorrowRates': undefined,
|
|
411
413
|
'fetchCurrencies': 'emulated',
|
|
@@ -3165,6 +3167,16 @@ export default class Exchange {
|
|
|
3165
3167
|
}
|
|
3166
3168
|
return result;
|
|
3167
3169
|
}
|
|
3170
|
+
marketsForSymbols(symbols = undefined) {
|
|
3171
|
+
if (symbols === undefined) {
|
|
3172
|
+
return symbols;
|
|
3173
|
+
}
|
|
3174
|
+
const result = [];
|
|
3175
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
3176
|
+
result.push(this.market(symbols[i]));
|
|
3177
|
+
}
|
|
3178
|
+
return result;
|
|
3179
|
+
}
|
|
3168
3180
|
marketSymbols(symbols = undefined, type = undefined, allowEmpty = true, sameTypeOnly = false, sameSubTypeOnly = false) {
|
|
3169
3181
|
if (symbols === undefined) {
|
|
3170
3182
|
if (!allowEmpty) {
|
|
@@ -3434,14 +3446,34 @@ export default class Exchange {
|
|
|
3434
3446
|
// marketIdKey should only be undefined when response is a dictionary
|
|
3435
3447
|
symbols = this.marketSymbols(symbols);
|
|
3436
3448
|
const tiers = {};
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3449
|
+
let symbolsLength = 0;
|
|
3450
|
+
if (symbols !== undefined) {
|
|
3451
|
+
symbolsLength = symbols.length;
|
|
3452
|
+
}
|
|
3453
|
+
const noSymbols = (symbols === undefined) || (symbolsLength === 0);
|
|
3454
|
+
if (Array.isArray(response)) {
|
|
3455
|
+
for (let i = 0; i < response.length; i++) {
|
|
3456
|
+
const item = response[i];
|
|
3457
|
+
const id = this.safeString(item, marketIdKey);
|
|
3458
|
+
const market = this.safeMarket(id, undefined, undefined, 'swap');
|
|
3459
|
+
const symbol = market['symbol'];
|
|
3460
|
+
const contract = this.safeBool(market, 'contract', false);
|
|
3461
|
+
if (contract && (noSymbols || this.inArray(symbol, symbols))) {
|
|
3462
|
+
tiers[symbol] = this.parseMarketLeverageTiers(item, market);
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
}
|
|
3466
|
+
else {
|
|
3467
|
+
const keys = Object.keys(response);
|
|
3468
|
+
for (let i = 0; i < keys.length; i++) {
|
|
3469
|
+
const marketId = keys[i];
|
|
3470
|
+
const item = response[marketId];
|
|
3471
|
+
const market = this.safeMarket(marketId, undefined, undefined, 'swap');
|
|
3472
|
+
const symbol = market['symbol'];
|
|
3473
|
+
const contract = this.safeBool(market, 'contract', false);
|
|
3474
|
+
if (contract && (noSymbols || this.inArray(symbol, symbols))) {
|
|
3475
|
+
tiers[symbol] = this.parseMarketLeverageTiers(item, market);
|
|
3476
|
+
}
|
|
3445
3477
|
}
|
|
3446
3478
|
}
|
|
3447
3479
|
return tiers;
|
|
@@ -4493,6 +4525,9 @@ export default class Exchange {
|
|
|
4493
4525
|
async fetchOption(symbol, params = {}) {
|
|
4494
4526
|
throw new NotSupported(this.id + ' fetchOption() is not supported yet');
|
|
4495
4527
|
}
|
|
4528
|
+
async fetchConvertQuote(fromCode, toCode, amount = undefined, params = {}) {
|
|
4529
|
+
throw new NotSupported(this.id + ' fetchConvertQuote() is not supported yet');
|
|
4530
|
+
}
|
|
4496
4531
|
async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4497
4532
|
/**
|
|
4498
4533
|
* @method
|
|
@@ -5041,6 +5076,9 @@ export default class Exchange {
|
|
|
5041
5076
|
const fees = await this.fetchTradingFees(params);
|
|
5042
5077
|
return this.safeDict(fees, symbol);
|
|
5043
5078
|
}
|
|
5079
|
+
async fetchConvertCurrencies(params = {}) {
|
|
5080
|
+
throw new NotSupported(this.id + ' fetchConvertCurrencies() is not supported yet');
|
|
5081
|
+
}
|
|
5044
5082
|
parseOpenInterest(interest, market = undefined) {
|
|
5045
5083
|
throw new NotSupported(this.id + ' parseOpenInterest () is not supported yet');
|
|
5046
5084
|
}
|
|
@@ -5738,7 +5776,10 @@ export default class Exchange {
|
|
|
5738
5776
|
return leverageStructures;
|
|
5739
5777
|
}
|
|
5740
5778
|
parseLeverage(leverage, market = undefined) {
|
|
5741
|
-
throw new NotSupported(this.id + ' parseLeverage() is not supported yet');
|
|
5779
|
+
throw new NotSupported(this.id + ' parseLeverage () is not supported yet');
|
|
5780
|
+
}
|
|
5781
|
+
parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
|
|
5782
|
+
throw new NotSupported(this.id + ' parseConversion () is not supported yet');
|
|
5742
5783
|
}
|
|
5743
5784
|
convertExpireDate(date) {
|
|
5744
5785
|
// parse YYMMDD to datetime string
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { concatBytes } from '../../static_dependencies/noble-curves/abstract/utils.js';
|
|
2
|
-
declare const json: (data: any, params?: any) => string, isJsonEncodedObject: (object: any) => boolean, binaryToString: (data: Uint8Array) => string, stringToBinary: (str: string) => Uint8Array, stringToBase64: (string:
|
|
2
|
+
declare const json: (data: any, params?: any) => string, isJsonEncodedObject: (object: any) => boolean, binaryToString: (data: Uint8Array) => string, stringToBinary: (str: string) => Uint8Array, stringToBase64: (string: string) => string, base64ToString: (string: string) => string, base64ToBinary: (str: string) => Uint8Array, binaryToBase64: (data: Uint8Array) => string, base16ToBinary: (str: string) => Uint8Array, binaryToBase16: (data: Uint8Array) => string, base58ToBinary: (str: string) => Uint8Array, binaryToBase58: (data: Uint8Array) => string, binaryConcat: typeof concatBytes, binaryConcatArray: (arr: any[]) => Uint8Array, urlencode: (object: object) => string, urlencodeNested: (object: object) => string, urlencodeWithArrayRepeat: (object: object) => string, rawencode: (object: object) => string, encode: (str: string) => Uint8Array, decode: (data: Uint8Array) => string, urlencodeBase64: (base64string: string) => string, numberToLE: (n: number, padding: number) => Uint8Array, numberToBE: (n: number, padding: number) => Uint8Array;
|
|
3
3
|
declare function packb(req: any): Uint8Array;
|
|
4
4
|
export { json, isJsonEncodedObject, binaryToString, stringToBinary, stringToBase64, base64ToBinary, base64ToString, binaryToBase64, base16ToBinary, binaryToBase16, binaryConcat, binaryConcatArray, urlencode, urlencodeWithArrayRepeat, rawencode, encode, decode, urlencodeBase64, numberToLE, numberToBE, base58ToBinary, binaryToBase58, urlencodeNested, packb };
|
|
@@ -11,13 +11,13 @@ import { numberToBytesBE, numberToBytesLE, concatBytes } from '../../static_depe
|
|
|
11
11
|
import { serialize } from '../../static_dependencies/messagepack/msgpack.js';
|
|
12
12
|
import qs from '../../static_dependencies/qs/index.cjs';
|
|
13
13
|
/* ------------------------------------------------------------------------ */
|
|
14
|
-
const json = (data, params = undefined) => JSON.stringify(data), isJsonEncodedObject = object => ((typeof object === 'string') &&
|
|
14
|
+
const json = (data, params = undefined) => JSON.stringify(data), isJsonEncodedObject = (object) => ((typeof object === 'string') &&
|
|
15
15
|
(object.length >= 2) &&
|
|
16
|
-
((object[0] === '{') || (object[0] === '['))), binaryToString = utf8.encode, stringToBinary = utf8.decode, stringToBase64 = string => base64.encode(utf8.decode(string)), base64ToString = string => utf8.encode(base64.decode(string)), base64ToBinary = base64.decode, binaryToBase64 = base64.encode, base16ToBinary = base16.decode, binaryToBase16 = base16.encode, base58ToBinary = base58.decode, binaryToBase58 = base58.encode, binaryConcat = concatBytes, binaryConcatArray = (arr) => concatBytes(...arr), urlencode = object => qs.stringify(object), urlencodeNested = object => qs.stringify(object) // implemented only in python
|
|
17
|
-
, urlencodeWithArrayRepeat = object => qs.stringify(object, { arrayFormat: 'repeat' }), rawencode = object => qs.stringify(object, { encode: false }), encode = utf8.decode // lol
|
|
16
|
+
((object[0] === '{') || (object[0] === '['))), binaryToString = utf8.encode, stringToBinary = utf8.decode, stringToBase64 = (string) => base64.encode(utf8.decode(string)), base64ToString = (string) => utf8.encode(base64.decode(string)), base64ToBinary = base64.decode, binaryToBase64 = base64.encode, base16ToBinary = base16.decode, binaryToBase16 = base16.encode, base58ToBinary = base58.decode, binaryToBase58 = base58.encode, binaryConcat = concatBytes, binaryConcatArray = (arr) => concatBytes(...arr), urlencode = (object) => qs.stringify(object), urlencodeNested = (object) => qs.stringify(object) // implemented only in python
|
|
17
|
+
, urlencodeWithArrayRepeat = (object) => qs.stringify(object, { arrayFormat: 'repeat' }), rawencode = (object) => qs.stringify(object, { encode: false }), encode = utf8.decode // lol
|
|
18
18
|
, decode = utf8.encode
|
|
19
19
|
// Url-safe-base64 without equals signs, with + replaced by - and slashes replaced by underscores
|
|
20
|
-
, urlencodeBase64 = base64string => base64string.replace(/[=]+$/, '')
|
|
20
|
+
, urlencodeBase64 = (base64string) => base64string.replace(/[=]+$/, '')
|
|
21
21
|
.replace(/\+/g, '-')
|
|
22
22
|
.replace(/\//g, '_'), numberToLE = (n, padding) => numberToBytesLE(BigInt(n), padding), numberToBE = (n, padding) => numberToBytesBE(BigInt(n), padding);
|
|
23
23
|
function packb(req) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CHash } from '../../static_dependencies/noble-hashes/utils.js';
|
|
2
|
-
declare function rsa(request: string, secret: string, hash: CHash): string
|
|
2
|
+
declare function rsa(request: string, secret: string, hash: CHash): string;
|
|
3
3
|
declare function jwt(request: {}, secret: Uint8Array, hash: CHash, isRSA?: boolean, opts?: {}): string;
|
|
4
4
|
export { rsa, jwt };
|
package/js/src/base/types.d.ts
CHANGED
|
@@ -427,6 +427,18 @@ export interface Greeks {
|
|
|
427
427
|
underlyingPrice: number;
|
|
428
428
|
info: any;
|
|
429
429
|
}
|
|
430
|
+
export interface Conversion {
|
|
431
|
+
info: any;
|
|
432
|
+
timestamp?: number;
|
|
433
|
+
datetime?: string;
|
|
434
|
+
id: string;
|
|
435
|
+
fromCurrency: string;
|
|
436
|
+
fromAmount: number;
|
|
437
|
+
toCurrency: string;
|
|
438
|
+
toAmount: number;
|
|
439
|
+
price: number;
|
|
440
|
+
fee: number;
|
|
441
|
+
}
|
|
430
442
|
export interface Option {
|
|
431
443
|
info: any;
|
|
432
444
|
currency: string;
|
package/js/src/binance.d.ts
CHANGED
|
@@ -439,4 +439,5 @@ export default class binance extends Exchange {
|
|
|
439
439
|
quoteVolume: any;
|
|
440
440
|
};
|
|
441
441
|
fetchMarginAdjustmentHistory(symbol?: Str, type?: Str, since?: Num, limit?: Num, params?: {}): Promise<MarginModification[]>;
|
|
442
|
+
fetchConvertCurrencies(params?: {}): Promise<Currencies>;
|
|
442
443
|
}
|
package/js/src/binance.js
CHANGED
|
@@ -74,6 +74,8 @@ export default class binance extends Exchange {
|
|
|
74
74
|
'fetchCanceledOrders': 'emulated',
|
|
75
75
|
'fetchClosedOrder': false,
|
|
76
76
|
'fetchClosedOrders': 'emulated',
|
|
77
|
+
'fetchConvertCurrencies': true,
|
|
78
|
+
'fetchConvertQuote': false,
|
|
77
79
|
'fetchCrossBorrowRate': true,
|
|
78
80
|
'fetchCrossBorrowRates': false,
|
|
79
81
|
'fetchCurrencies': true,
|
|
@@ -973,6 +975,7 @@ export default class binance extends Exchange {
|
|
|
973
975
|
},
|
|
974
976
|
'post': {
|
|
975
977
|
'order/oco': 0.2,
|
|
978
|
+
'orderList/oco': 0.2,
|
|
976
979
|
'sor/order': 0.2,
|
|
977
980
|
'sor/order/test': 0.2,
|
|
978
981
|
'order': 0.2,
|
|
@@ -4240,11 +4243,14 @@ export default class binance extends Exchange {
|
|
|
4240
4243
|
'interval': this.safeString(this.timeframes, timeframe, timeframe),
|
|
4241
4244
|
'limit': limit,
|
|
4242
4245
|
};
|
|
4246
|
+
const marketId = market['id'];
|
|
4243
4247
|
if (price === 'index') {
|
|
4244
|
-
|
|
4248
|
+
const parts = marketId.split('_');
|
|
4249
|
+
const pair = this.safeString(parts, 0);
|
|
4250
|
+
request['pair'] = pair; // Index price takes this argument instead of symbol
|
|
4245
4251
|
}
|
|
4246
4252
|
else {
|
|
4247
|
-
request['symbol'] =
|
|
4253
|
+
request['symbol'] = marketId;
|
|
4248
4254
|
}
|
|
4249
4255
|
// const duration = this.parseTimeframe (timeframe);
|
|
4250
4256
|
if (since !== undefined) {
|
|
@@ -12589,4 +12595,59 @@ export default class binance extends Exchange {
|
|
|
12589
12595
|
const modifications = this.parseMarginModifications(response);
|
|
12590
12596
|
return this.filterBySymbolSinceLimit(modifications, symbol, since, limit);
|
|
12591
12597
|
}
|
|
12598
|
+
async fetchConvertCurrencies(params = {}) {
|
|
12599
|
+
/**
|
|
12600
|
+
* @method
|
|
12601
|
+
* @name binance#fetchConvertCurrencies
|
|
12602
|
+
* @description fetches all available currencies that can be converted
|
|
12603
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#query-order-quantity-precision-per-asset-user_data
|
|
12604
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
12605
|
+
* @returns {object} an associative dictionary of currencies
|
|
12606
|
+
*/
|
|
12607
|
+
await this.loadMarkets();
|
|
12608
|
+
const response = await this.sapiGetConvertAssetInfo(params);
|
|
12609
|
+
//
|
|
12610
|
+
// [
|
|
12611
|
+
// {
|
|
12612
|
+
// "asset": "BTC",
|
|
12613
|
+
// "fraction": 8
|
|
12614
|
+
// },
|
|
12615
|
+
// ]
|
|
12616
|
+
//
|
|
12617
|
+
const result = {};
|
|
12618
|
+
for (let i = 0; i < response.length; i++) {
|
|
12619
|
+
const entry = response[i];
|
|
12620
|
+
const id = this.safeString(entry, 'asset');
|
|
12621
|
+
const code = this.safeCurrencyCode(id);
|
|
12622
|
+
result[code] = {
|
|
12623
|
+
'info': entry,
|
|
12624
|
+
'id': id,
|
|
12625
|
+
'code': code,
|
|
12626
|
+
'networks': undefined,
|
|
12627
|
+
'type': undefined,
|
|
12628
|
+
'name': undefined,
|
|
12629
|
+
'active': undefined,
|
|
12630
|
+
'deposit': undefined,
|
|
12631
|
+
'withdraw': undefined,
|
|
12632
|
+
'fee': undefined,
|
|
12633
|
+
'precision': this.safeInteger(entry, 'fraction'),
|
|
12634
|
+
'limits': {
|
|
12635
|
+
'amount': {
|
|
12636
|
+
'min': undefined,
|
|
12637
|
+
'max': undefined,
|
|
12638
|
+
},
|
|
12639
|
+
'withdraw': {
|
|
12640
|
+
'min': undefined,
|
|
12641
|
+
'max': undefined,
|
|
12642
|
+
},
|
|
12643
|
+
'deposit': {
|
|
12644
|
+
'min': undefined,
|
|
12645
|
+
'max': undefined,
|
|
12646
|
+
},
|
|
12647
|
+
},
|
|
12648
|
+
'created': undefined,
|
|
12649
|
+
};
|
|
12650
|
+
}
|
|
12651
|
+
return result;
|
|
12652
|
+
}
|
|
12592
12653
|
}
|