ccxt 4.3.13 → 4.3.14
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/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +8 -0
- package/dist/cjs/src/binance.js +103 -2
- package/dist/cjs/src/bybit.js +99 -99
- package/dist/cjs/src/coinbase.js +103 -0
- package/dist/cjs/src/coinex.js +399 -388
- package/dist/cjs/src/okx.js +1 -1
- package/dist/cjs/src/pro/woo.js +147 -9
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +1 -1
- package/js/src/base/Exchange.js +8 -0
- package/js/src/base/functions/generic.d.ts +1 -1
- package/js/src/base/functions/rsa.d.ts +2 -1
- package/js/src/base/functions/totp.d.ts +1 -1
- package/js/src/binance.d.ts +14 -1
- package/js/src/binance.js +103 -2
- package/js/src/bybit.js +99 -99
- package/js/src/coinbase.d.ts +5 -1
- package/js/src/coinbase.js +103 -0
- package/js/src/coinex.js +399 -388
- package/js/src/okx.js +1 -1
- package/js/src/pro/woo.d.ts +2 -0
- package/js/src/pro/woo.js +147 -9
- package/package.json +1 -1
package/dist/cjs/src/coinbase.js
CHANGED
|
@@ -44,6 +44,7 @@ class coinbase extends coinbase$1 {
|
|
|
44
44
|
'cancelOrders': true,
|
|
45
45
|
'closeAllPositions': false,
|
|
46
46
|
'closePosition': true,
|
|
47
|
+
'createConvertTrade': true,
|
|
47
48
|
'createDepositAddress': true,
|
|
48
49
|
'createLimitBuyOrder': true,
|
|
49
50
|
'createLimitSellOrder': true,
|
|
@@ -67,6 +68,9 @@ class coinbase extends coinbase$1 {
|
|
|
67
68
|
'fetchBorrowRateHistory': false,
|
|
68
69
|
'fetchCanceledOrders': true,
|
|
69
70
|
'fetchClosedOrders': true,
|
|
71
|
+
'fetchConvertQuote': true,
|
|
72
|
+
'fetchConvertTrade': true,
|
|
73
|
+
'fetchConvertTradeHistory': false,
|
|
70
74
|
'fetchCrossBorrowRate': false,
|
|
71
75
|
'fetchCrossBorrowRates': false,
|
|
72
76
|
'fetchCurrencies': true,
|
|
@@ -4130,6 +4134,105 @@ class coinbase extends coinbase$1 {
|
|
|
4130
4134
|
const data = this.safeDict(response, 'data', {});
|
|
4131
4135
|
return this.parseTransaction(data);
|
|
4132
4136
|
}
|
|
4137
|
+
async fetchConvertQuote(fromCode, toCode, amount = undefined, params = {}) {
|
|
4138
|
+
/**
|
|
4139
|
+
* @method
|
|
4140
|
+
* @name coinbase#fetchConvertQuote
|
|
4141
|
+
* @description fetch a quote for converting from one currency to another
|
|
4142
|
+
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_createconvertquote
|
|
4143
|
+
* @param {string} fromCode the currency that you want to sell and convert from
|
|
4144
|
+
* @param {string} toCode the currency that you want to buy and convert into
|
|
4145
|
+
* @param {float} [amount] how much you want to trade in units of the from currency
|
|
4146
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4147
|
+
* @param {object} [params.trade_incentive_metadata] an object to fill in user incentive data
|
|
4148
|
+
* @param {string} [params.trade_incentive_metadata.user_incentive_id] the id of the incentive
|
|
4149
|
+
* @param {string} [params.trade_incentive_metadata.code_val] the code value of the incentive
|
|
4150
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
4151
|
+
*/
|
|
4152
|
+
await this.loadMarkets();
|
|
4153
|
+
const request = {
|
|
4154
|
+
'from_account': fromCode,
|
|
4155
|
+
'to_account': toCode,
|
|
4156
|
+
'amount': this.numberToString(amount),
|
|
4157
|
+
};
|
|
4158
|
+
const response = await this.v3PrivatePostBrokerageConvertQuote(this.extend(request, params));
|
|
4159
|
+
const data = this.safeDict(response, 'trade', {});
|
|
4160
|
+
return this.parseConversion(data);
|
|
4161
|
+
}
|
|
4162
|
+
async createConvertTrade(id, fromCode, toCode, amount = undefined, params = {}) {
|
|
4163
|
+
/**
|
|
4164
|
+
* @method
|
|
4165
|
+
* @name coinbase#createConvertTrade
|
|
4166
|
+
* @description convert from one currency to another
|
|
4167
|
+
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_commitconverttrade
|
|
4168
|
+
* @param {string} id the id of the trade that you want to make
|
|
4169
|
+
* @param {string} fromCode the currency that you want to sell and convert from
|
|
4170
|
+
* @param {string} toCode the currency that you want to buy and convert into
|
|
4171
|
+
* @param {float} [amount] how much you want to trade in units of the from currency
|
|
4172
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4173
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
4174
|
+
*/
|
|
4175
|
+
await this.loadMarkets();
|
|
4176
|
+
const request = {
|
|
4177
|
+
'trade_id': id,
|
|
4178
|
+
'from_account': fromCode,
|
|
4179
|
+
'to_account': toCode,
|
|
4180
|
+
};
|
|
4181
|
+
const response = await this.v3PrivatePostBrokerageConvertTradeTradeId(this.extend(request, params));
|
|
4182
|
+
const data = this.safeDict(response, 'trade', {});
|
|
4183
|
+
return this.parseConversion(data);
|
|
4184
|
+
}
|
|
4185
|
+
async fetchConvertTrade(id, code = undefined, params = {}) {
|
|
4186
|
+
/**
|
|
4187
|
+
* @method
|
|
4188
|
+
* @name coinbase#fetchConvertTrade
|
|
4189
|
+
* @description fetch the data for a conversion trade
|
|
4190
|
+
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getconverttrade
|
|
4191
|
+
* @param {string} id the id of the trade that you want to commit
|
|
4192
|
+
* @param {string} code the unified currency code that was converted from
|
|
4193
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4194
|
+
* @param {strng} params.toCode the unified currency code that was converted into
|
|
4195
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
4196
|
+
*/
|
|
4197
|
+
await this.loadMarkets();
|
|
4198
|
+
if (code === undefined) {
|
|
4199
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchConvertTrade() requires a code argument');
|
|
4200
|
+
}
|
|
4201
|
+
const toCode = this.safeString(params, 'toCode');
|
|
4202
|
+
if (toCode === undefined) {
|
|
4203
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchConvertTrade() requires a toCode parameter');
|
|
4204
|
+
}
|
|
4205
|
+
params = this.omit(params, 'toCode');
|
|
4206
|
+
const request = {
|
|
4207
|
+
'trade_id': id,
|
|
4208
|
+
'from_account': code,
|
|
4209
|
+
'to_account': toCode,
|
|
4210
|
+
};
|
|
4211
|
+
const response = await this.v3PrivateGetBrokerageConvertTradeTradeId(this.extend(request, params));
|
|
4212
|
+
const data = this.safeDict(response, 'trade', {});
|
|
4213
|
+
return this.parseConversion(data);
|
|
4214
|
+
}
|
|
4215
|
+
parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
|
|
4216
|
+
const fromCoin = this.safeString(conversion, 'source_currency');
|
|
4217
|
+
const fromCode = this.safeCurrencyCode(fromCoin, fromCurrency);
|
|
4218
|
+
const to = this.safeString(conversion, 'target_currency');
|
|
4219
|
+
const toCode = this.safeCurrencyCode(to, toCurrency);
|
|
4220
|
+
const fromAmountStructure = this.safeDict(conversion, 'user_entered_amount');
|
|
4221
|
+
const feeStructure = this.safeDict(conversion, 'total_fee');
|
|
4222
|
+
const feeAmountStructure = this.safeDict(feeStructure, 'amount');
|
|
4223
|
+
return {
|
|
4224
|
+
'info': conversion,
|
|
4225
|
+
'timestamp': undefined,
|
|
4226
|
+
'datetime': undefined,
|
|
4227
|
+
'id': this.safeString(conversion, 'id'),
|
|
4228
|
+
'fromCurrency': fromCode,
|
|
4229
|
+
'fromAmount': this.safeNumber(fromAmountStructure, 'value'),
|
|
4230
|
+
'toCurrency': toCode,
|
|
4231
|
+
'toAmount': undefined,
|
|
4232
|
+
'price': undefined,
|
|
4233
|
+
'fee': this.safeNumber(feeAmountStructure, 'value'),
|
|
4234
|
+
};
|
|
4235
|
+
}
|
|
4133
4236
|
async closePosition(symbol, side = undefined, params = {}) {
|
|
4134
4237
|
/**
|
|
4135
4238
|
* @method
|