ccxt 4.2.93 → 4.2.95
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.js +1055 -366
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +22 -1
- package/dist/cjs/src/base/errors.js +25 -64
- package/dist/cjs/src/base/ws/OrderBookSide.js +5 -0
- package/dist/cjs/src/binance.js +63 -2
- package/dist/cjs/src/bitget.js +139 -0
- package/dist/cjs/src/bitstamp.js +6 -0
- package/dist/cjs/src/coinex.js +61 -55
- package/dist/cjs/src/gemini.js +2 -1
- package/dist/cjs/src/htx.js +127 -125
- package/dist/cjs/src/okx.js +193 -40
- package/dist/cjs/src/pro/coinbase.js +18 -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/woo.js +139 -0
- package/examples/js/cli.js +4 -1
- package/examples/ts/cli.ts +4 -1
- package/js/ccxt.d.ts +4 -4
- package/js/ccxt.js +3 -3
- 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/abstract/bitstamp.d.ts +6 -0
- package/js/src/base/Exchange.d.ts +8 -2
- package/js/src/base/Exchange.js +22 -1
- package/js/src/base/errorHierarchy.d.ts +1 -1
- package/js/src/base/errorHierarchy.js +1 -1
- package/js/src/base/errors.d.ts +26 -26
- package/js/src/base/errors.js +26 -66
- package/js/src/base/types.d.ts +12 -0
- package/js/src/base/ws/OrderBook.d.ts +7 -0
- package/js/src/base/ws/OrderBook.js +1 -6
- package/js/src/base/ws/OrderBookSide.d.ts +9 -3
- package/js/src/base/ws/OrderBookSide.js +6 -1
- 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/bitstamp.js +6 -0
- package/js/src/coinex.js +61 -55
- package/js/src/gemini.js +2 -1
- package/js/src/htx.d.ts +1 -0
- package/js/src/htx.js +128 -126
- package/js/src/okx.d.ts +4 -1
- package/js/src/okx.js +193 -40
- package/js/src/pro/coinbase.js +18 -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/woo.d.ts +4 -1
- package/js/src/woo.js +139 -0
- package/package.json +1 -1
- package/skip-tests.json +5 -0
package/js/src/woo.js
CHANGED
|
@@ -60,6 +60,8 @@ export default class woo extends Exchange {
|
|
|
60
60
|
'fetchCanceledOrders': false,
|
|
61
61
|
'fetchClosedOrder': false,
|
|
62
62
|
'fetchClosedOrders': true,
|
|
63
|
+
'fetchConvertCurrencies': true,
|
|
64
|
+
'fetchConvertQuote': true,
|
|
63
65
|
'fetchCurrencies': true,
|
|
64
66
|
'fetchDepositAddress': true,
|
|
65
67
|
'fetchDeposits': true,
|
|
@@ -2988,6 +2990,143 @@ export default class woo extends Exchange {
|
|
|
2988
2990
|
'takeProfitPrice': undefined,
|
|
2989
2991
|
});
|
|
2990
2992
|
}
|
|
2993
|
+
async fetchConvertQuote(fromCode, toCode, amount = undefined, params = {}) {
|
|
2994
|
+
/**
|
|
2995
|
+
* @method
|
|
2996
|
+
* @name woo#fetchConvertQuote
|
|
2997
|
+
* @description fetch a quote for converting from one currency to another
|
|
2998
|
+
* @see https://docs.woo.org/#get-quote-rfq
|
|
2999
|
+
* @param {string} fromCode the currency that you want to sell and convert from
|
|
3000
|
+
* @param {string} toCode the currency that you want to buy and convert into
|
|
3001
|
+
* @param {float} [amount] how much you want to trade in units of the from currency
|
|
3002
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3003
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
3004
|
+
*/
|
|
3005
|
+
await this.loadMarkets();
|
|
3006
|
+
const request = {
|
|
3007
|
+
'sellToken': fromCode.toUpperCase(),
|
|
3008
|
+
'buyToken': toCode.toUpperCase(),
|
|
3009
|
+
'sellQuantity': this.numberToString(amount),
|
|
3010
|
+
};
|
|
3011
|
+
const response = await this.v3PrivateGetConvertRfq(this.extend(request, params));
|
|
3012
|
+
//
|
|
3013
|
+
// {
|
|
3014
|
+
// "success": true,
|
|
3015
|
+
// "data": {
|
|
3016
|
+
// "quoteId": 123123123,
|
|
3017
|
+
// "counterPartyId": "",
|
|
3018
|
+
// "sellToken": "ETH",
|
|
3019
|
+
// "sellQuantity": "0.0445",
|
|
3020
|
+
// "buyToken": "USDT",
|
|
3021
|
+
// "buyQuantity": "33.45",
|
|
3022
|
+
// "buyPrice": "6.77",
|
|
3023
|
+
// "expireTimestamp": 1659084466000,
|
|
3024
|
+
// "message": 1659084466000
|
|
3025
|
+
// }
|
|
3026
|
+
// }
|
|
3027
|
+
//
|
|
3028
|
+
const data = this.safeDict(response, 'data', {});
|
|
3029
|
+
const fromCurrencyId = this.safeString(data, 'sellToken', fromCode);
|
|
3030
|
+
const fromCurrency = this.currency(fromCurrencyId);
|
|
3031
|
+
const toCurrencyId = this.safeString(data, 'buyToken', toCode);
|
|
3032
|
+
const toCurrency = this.currency(toCurrencyId);
|
|
3033
|
+
return this.parseConversion(data, fromCurrency, toCurrency);
|
|
3034
|
+
}
|
|
3035
|
+
parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
|
|
3036
|
+
//
|
|
3037
|
+
// fetchConvertQuote
|
|
3038
|
+
//
|
|
3039
|
+
// {
|
|
3040
|
+
// "quoteId": 123123123,
|
|
3041
|
+
// "counterPartyId": "",
|
|
3042
|
+
// "sellToken": "ETH",
|
|
3043
|
+
// "sellQuantity": "0.0445",
|
|
3044
|
+
// "buyToken": "USDT",
|
|
3045
|
+
// "buyQuantity": "33.45",
|
|
3046
|
+
// "buyPrice": "6.77",
|
|
3047
|
+
// "expireTimestamp": 1659084466000,
|
|
3048
|
+
// "message": 1659084466000
|
|
3049
|
+
// }
|
|
3050
|
+
//
|
|
3051
|
+
const timestamp = this.safeInteger(conversion, 'expireTimestamp');
|
|
3052
|
+
const fromCoin = this.safeString(conversion, 'sellToken');
|
|
3053
|
+
const fromCode = this.safeCurrencyCode(fromCoin, fromCurrency);
|
|
3054
|
+
const to = this.safeString(conversion, 'buyToken');
|
|
3055
|
+
const toCode = this.safeCurrencyCode(to, toCurrency);
|
|
3056
|
+
return {
|
|
3057
|
+
'info': conversion,
|
|
3058
|
+
'timestamp': timestamp,
|
|
3059
|
+
'datetime': this.iso8601(timestamp),
|
|
3060
|
+
'id': this.safeString(conversion, 'quoteId'),
|
|
3061
|
+
'fromCurrency': fromCode,
|
|
3062
|
+
'fromAmount': this.safeNumber(conversion, 'sellQuantity'),
|
|
3063
|
+
'toCurrency': toCode,
|
|
3064
|
+
'toAmount': this.safeNumber(conversion, 'buyQuantity'),
|
|
3065
|
+
'price': this.safeNumber(conversion, 'buyPrice'),
|
|
3066
|
+
'fee': undefined,
|
|
3067
|
+
};
|
|
3068
|
+
}
|
|
3069
|
+
async fetchConvertCurrencies(params = {}) {
|
|
3070
|
+
/**
|
|
3071
|
+
* @method
|
|
3072
|
+
* @name woo#fetchConvertCurrencies
|
|
3073
|
+
* @description fetches all available currencies that can be converted
|
|
3074
|
+
* @see https://docs.woo.org/#get-quote-asset-info
|
|
3075
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3076
|
+
* @returns {object} an associative dictionary of currencies
|
|
3077
|
+
*/
|
|
3078
|
+
await this.loadMarkets();
|
|
3079
|
+
const response = await this.v3PrivateGetConvertAssetInfo(params);
|
|
3080
|
+
//
|
|
3081
|
+
// {
|
|
3082
|
+
// "success": true,
|
|
3083
|
+
// "rows": [
|
|
3084
|
+
// {
|
|
3085
|
+
// "token": "BTC",
|
|
3086
|
+
// "tick": 0.0001,
|
|
3087
|
+
// "createdTime": "1575014248.99", // Unix epoch time in seconds
|
|
3088
|
+
// "updatedTime": "1575014248.99" // Unix epoch time in seconds
|
|
3089
|
+
// },
|
|
3090
|
+
// ]
|
|
3091
|
+
// }
|
|
3092
|
+
//
|
|
3093
|
+
const result = {};
|
|
3094
|
+
const data = this.safeList(response, 'rows', []);
|
|
3095
|
+
for (let i = 0; i < data.length; i++) {
|
|
3096
|
+
const entry = data[i];
|
|
3097
|
+
const id = this.safeString(entry, 'token');
|
|
3098
|
+
const code = this.safeCurrencyCode(id);
|
|
3099
|
+
result[code] = {
|
|
3100
|
+
'info': entry,
|
|
3101
|
+
'id': id,
|
|
3102
|
+
'code': code,
|
|
3103
|
+
'networks': undefined,
|
|
3104
|
+
'type': undefined,
|
|
3105
|
+
'name': undefined,
|
|
3106
|
+
'active': undefined,
|
|
3107
|
+
'deposit': undefined,
|
|
3108
|
+
'withdraw': undefined,
|
|
3109
|
+
'fee': undefined,
|
|
3110
|
+
'precision': this.safeNumber(entry, 'tick'),
|
|
3111
|
+
'limits': {
|
|
3112
|
+
'amount': {
|
|
3113
|
+
'min': undefined,
|
|
3114
|
+
'max': undefined,
|
|
3115
|
+
},
|
|
3116
|
+
'withdraw': {
|
|
3117
|
+
'min': undefined,
|
|
3118
|
+
'max': undefined,
|
|
3119
|
+
},
|
|
3120
|
+
'deposit': {
|
|
3121
|
+
'min': undefined,
|
|
3122
|
+
'max': undefined,
|
|
3123
|
+
},
|
|
3124
|
+
},
|
|
3125
|
+
'created': this.safeTimestamp(entry, 'createdTime'),
|
|
3126
|
+
};
|
|
3127
|
+
}
|
|
3128
|
+
return result;
|
|
3129
|
+
}
|
|
2991
3130
|
defaultNetworkCodeForCurrency(code) {
|
|
2992
3131
|
const currencyItem = this.currency(code);
|
|
2993
3132
|
const networks = currencyItem['networks'];
|
package/package.json
CHANGED
package/skip-tests.json
CHANGED
|
@@ -1041,6 +1041,7 @@
|
|
|
1041
1041
|
"latoken": {
|
|
1042
1042
|
"skipMethods":{
|
|
1043
1043
|
"loadMarkets": {
|
|
1044
|
+
"precision": "messed just for one pair https://app.travis-ci.com/github/ccxt/ccxt/builds/269924468#L4006",
|
|
1044
1045
|
"currency": "messed",
|
|
1045
1046
|
"currencyIdAndCode": "messed"
|
|
1046
1047
|
},
|
|
@@ -1318,6 +1319,10 @@
|
|
|
1318
1319
|
},
|
|
1319
1320
|
"watchTrades": {
|
|
1320
1321
|
"timestamp": "timestamp reversed: https://app.travis-ci.com/github/ccxt/ccxt/builds/269484317#L3681"
|
|
1322
|
+
},
|
|
1323
|
+
"watchBidsAsks": {
|
|
1324
|
+
"bidVolume": "https://app.travis-ci.com/github/ccxt/ccxt/builds/269878519#L3759",
|
|
1325
|
+
"askVolume": "same"
|
|
1321
1326
|
}
|
|
1322
1327
|
},
|
|
1323
1328
|
"timeout": 120000
|