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/js/src/woo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/woo.js';
|
|
2
|
-
import type { TransferEntry, Balances, Currency, FundingRateHistory, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, Transaction, Leverage, Account, Currencies, TradingFees } from './base/types.js';
|
|
2
|
+
import type { TransferEntry, Balances, Currency, FundingRateHistory, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, Transaction, Leverage, Account, Currencies, TradingFees, Conversion } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class woo
|
|
5
5
|
* @augments Exchange
|
|
@@ -174,6 +174,9 @@ export default class woo extends Exchange {
|
|
|
174
174
|
fetchPosition(symbol?: Str, params?: {}): Promise<import("./base/types.js").Position>;
|
|
175
175
|
fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
|
|
176
176
|
parsePosition(position: any, market?: Market): import("./base/types.js").Position;
|
|
177
|
+
fetchConvertQuote(fromCode: string, toCode: string, amount?: Num, params?: {}): Promise<Conversion>;
|
|
178
|
+
parseConversion(conversion: any, fromCurrency?: Currency, toCurrency?: Currency): Conversion;
|
|
179
|
+
fetchConvertCurrencies(params?: {}): Promise<Currencies>;
|
|
177
180
|
defaultNetworkCodeForCurrency(code: any): any;
|
|
178
181
|
setSandboxMode(enable: boolean): void;
|
|
179
182
|
}
|
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
|
@@ -1318,6 +1318,10 @@
|
|
|
1318
1318
|
},
|
|
1319
1319
|
"watchTrades": {
|
|
1320
1320
|
"timestamp": "timestamp reversed: https://app.travis-ci.com/github/ccxt/ccxt/builds/269484317#L3681"
|
|
1321
|
+
},
|
|
1322
|
+
"watchBidsAsks": {
|
|
1323
|
+
"bidVolume": "https://app.travis-ci.com/github/ccxt/ccxt/builds/269878519#L3759",
|
|
1324
|
+
"askVolume": "same"
|
|
1321
1325
|
}
|
|
1322
1326
|
},
|
|
1323
1327
|
"timeout": 120000
|