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/dist/cjs/ccxt.js
CHANGED
|
@@ -182,7 +182,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
182
182
|
|
|
183
183
|
//-----------------------------------------------------------------------------
|
|
184
184
|
// this is updated by vss.js when building
|
|
185
|
-
const version = '4.2.
|
|
185
|
+
const version = '4.2.95';
|
|
186
186
|
Exchange["default"].ccxtVersion = version;
|
|
187
187
|
const exchanges = {
|
|
188
188
|
'ace': ace,
|
|
@@ -421,6 +421,8 @@ class Exchange {
|
|
|
421
421
|
'fetchClosedOrder': undefined,
|
|
422
422
|
'fetchClosedOrders': undefined,
|
|
423
423
|
'fetchClosedOrdersWs': undefined,
|
|
424
|
+
'fetchConvertCurrencies': undefined,
|
|
425
|
+
'fetchConvertQuote': undefined,
|
|
424
426
|
'fetchCrossBorrowRate': undefined,
|
|
425
427
|
'fetchCrossBorrowRates': undefined,
|
|
426
428
|
'fetchCurrencies': 'emulated',
|
|
@@ -3178,6 +3180,16 @@ class Exchange {
|
|
|
3178
3180
|
}
|
|
3179
3181
|
return result;
|
|
3180
3182
|
}
|
|
3183
|
+
marketsForSymbols(symbols = undefined) {
|
|
3184
|
+
if (symbols === undefined) {
|
|
3185
|
+
return symbols;
|
|
3186
|
+
}
|
|
3187
|
+
const result = [];
|
|
3188
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
3189
|
+
result.push(this.market(symbols[i]));
|
|
3190
|
+
}
|
|
3191
|
+
return result;
|
|
3192
|
+
}
|
|
3181
3193
|
marketSymbols(symbols = undefined, type = undefined, allowEmpty = true, sameTypeOnly = false, sameSubTypeOnly = false) {
|
|
3182
3194
|
if (symbols === undefined) {
|
|
3183
3195
|
if (!allowEmpty) {
|
|
@@ -4526,6 +4538,9 @@ class Exchange {
|
|
|
4526
4538
|
async fetchOption(symbol, params = {}) {
|
|
4527
4539
|
throw new errors.NotSupported(this.id + ' fetchOption() is not supported yet');
|
|
4528
4540
|
}
|
|
4541
|
+
async fetchConvertQuote(fromCode, toCode, amount = undefined, params = {}) {
|
|
4542
|
+
throw new errors.NotSupported(this.id + ' fetchConvertQuote() is not supported yet');
|
|
4543
|
+
}
|
|
4529
4544
|
async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4530
4545
|
/**
|
|
4531
4546
|
* @method
|
|
@@ -5074,6 +5089,9 @@ class Exchange {
|
|
|
5074
5089
|
const fees = await this.fetchTradingFees(params);
|
|
5075
5090
|
return this.safeDict(fees, symbol);
|
|
5076
5091
|
}
|
|
5092
|
+
async fetchConvertCurrencies(params = {}) {
|
|
5093
|
+
throw new errors.NotSupported(this.id + ' fetchConvertCurrencies() is not supported yet');
|
|
5094
|
+
}
|
|
5077
5095
|
parseOpenInterest(interest, market = undefined) {
|
|
5078
5096
|
throw new errors.NotSupported(this.id + ' parseOpenInterest () is not supported yet');
|
|
5079
5097
|
}
|
|
@@ -5771,7 +5789,10 @@ class Exchange {
|
|
|
5771
5789
|
return leverageStructures;
|
|
5772
5790
|
}
|
|
5773
5791
|
parseLeverage(leverage, market = undefined) {
|
|
5774
|
-
throw new errors.NotSupported(this.id + ' parseLeverage() is not supported yet');
|
|
5792
|
+
throw new errors.NotSupported(this.id + ' parseLeverage () is not supported yet');
|
|
5793
|
+
}
|
|
5794
|
+
parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
|
|
5795
|
+
throw new errors.NotSupported(this.id + ' parseConversion () is not supported yet');
|
|
5775
5796
|
}
|
|
5776
5797
|
convertExpireDate(date) {
|
|
5777
5798
|
// parse YYMMDD to datetime string
|
|
@@ -3,74 +3,37 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
/* eslint-disable max-classes-per-file */
|
|
6
|
-
// import { errorHierarchy } from './errorHierarchy.js';
|
|
7
|
-
// Commented out since I'm not sure this is mandatory anymore
|
|
8
|
-
// and does not work out of the box with esm
|
|
9
|
-
// /* ------------------------------------------------------------------------ */
|
|
10
|
-
// function subclass (BaseClass, classes, namespace = {}) {
|
|
11
|
-
// for (const [className, subclasses] of Object.entries (classes)) {
|
|
12
|
-
// const Class = Object.assign (namespace, {
|
|
13
|
-
// /* By creating a named property, we trick compiler to assign our class constructor function a name.
|
|
14
|
-
// Otherwise, all our error constructors would be shown as [Function: Error] in the debugger! And
|
|
15
|
-
// the super-useful `e.constructor.name` magic wouldn't work — we then would have no chance to
|
|
16
|
-
// obtain a error type string from an error instance programmatically! */
|
|
17
|
-
// [className]: class extends BaseClass {
|
|
18
|
-
// constructor (message) {
|
|
19
|
-
// super (message)
|
|
20
|
-
// /* A workaround to make `instanceof` work on custom Error classes in transpiled ES5.
|
|
21
|
-
// See my blog post for the explanation of this hack:
|
|
22
|
-
// https://medium.com/@xpl/javascript-deriving-from-error-properly-8d2f8f315801 */
|
|
23
|
-
// this.constructor = Class
|
|
24
|
-
// this.__proto__ = Class.prototype
|
|
25
|
-
// this.name = className
|
|
26
|
-
// this.message = message
|
|
27
|
-
// // https://github.com/Microsoft/TypeScript/wiki/FAQ#why-doesnt-extending-built-ins-like-error-array-and-map-work
|
|
28
|
-
// Object.setPrototypeOf (this, Class.prototype)
|
|
29
|
-
// }
|
|
30
|
-
// }
|
|
31
|
-
// })[className]
|
|
32
|
-
// subclass (Class, subclasses, namespace)
|
|
33
|
-
// }
|
|
34
|
-
// return namespace
|
|
35
|
-
// }
|
|
36
6
|
class BaseError extends Error {
|
|
37
7
|
constructor(message) {
|
|
38
8
|
super(message);
|
|
39
9
|
this.name = 'BaseError';
|
|
40
10
|
}
|
|
41
11
|
}
|
|
42
|
-
|
|
43
|
-
class ExchangeError extends Error {
|
|
12
|
+
class ExchangeError extends BaseError {
|
|
44
13
|
constructor(message) {
|
|
45
14
|
super(message);
|
|
46
15
|
this.name = 'ExchangeError';
|
|
47
16
|
}
|
|
48
17
|
}
|
|
49
|
-
class ExchangeClosedByUser extends Error {
|
|
50
|
-
constructor(message) {
|
|
51
|
-
super(message);
|
|
52
|
-
this.name = 'ExchangeClosedByUser';
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
18
|
class AuthenticationError extends ExchangeError {
|
|
56
19
|
constructor(message) {
|
|
57
20
|
super(message);
|
|
58
21
|
this.name = 'AuthenticationError';
|
|
59
22
|
}
|
|
60
23
|
}
|
|
61
|
-
class PermissionDenied extends
|
|
24
|
+
class PermissionDenied extends AuthenticationError {
|
|
62
25
|
constructor(message) {
|
|
63
26
|
super(message);
|
|
64
27
|
this.name = 'PermissionDenied';
|
|
65
28
|
}
|
|
66
29
|
}
|
|
67
|
-
class AccountNotEnabled extends
|
|
30
|
+
class AccountNotEnabled extends PermissionDenied {
|
|
68
31
|
constructor(message) {
|
|
69
32
|
super(message);
|
|
70
33
|
this.name = 'AccountNotEnabled';
|
|
71
34
|
}
|
|
72
35
|
}
|
|
73
|
-
class AccountSuspended extends
|
|
36
|
+
class AccountSuspended extends AuthenticationError {
|
|
74
37
|
constructor(message) {
|
|
75
38
|
super(message);
|
|
76
39
|
this.name = 'AccountSuspended';
|
|
@@ -88,16 +51,16 @@ class BadRequest extends ExchangeError {
|
|
|
88
51
|
this.name = 'BadRequest';
|
|
89
52
|
}
|
|
90
53
|
}
|
|
91
|
-
class
|
|
54
|
+
class BadSymbol extends BadRequest {
|
|
92
55
|
constructor(message) {
|
|
93
56
|
super(message);
|
|
94
|
-
this.name = '
|
|
57
|
+
this.name = 'BadSymbol';
|
|
95
58
|
}
|
|
96
59
|
}
|
|
97
|
-
class
|
|
60
|
+
class OperationRejected extends ExchangeError {
|
|
98
61
|
constructor(message) {
|
|
99
62
|
super(message);
|
|
100
|
-
this.name = '
|
|
63
|
+
this.name = 'OperationRejected';
|
|
101
64
|
}
|
|
102
65
|
}
|
|
103
66
|
class NoChange extends OperationRejected {
|
|
@@ -118,7 +81,7 @@ class BadResponse extends ExchangeError {
|
|
|
118
81
|
this.name = 'BadResponse';
|
|
119
82
|
}
|
|
120
83
|
}
|
|
121
|
-
class NullResponse extends
|
|
84
|
+
class NullResponse extends BadResponse {
|
|
122
85
|
constructor(message) {
|
|
123
86
|
super(message);
|
|
124
87
|
this.name = 'NullResponse';
|
|
@@ -148,12 +111,6 @@ class InvalidOrder extends ExchangeError {
|
|
|
148
111
|
this.name = 'InvalidOrder';
|
|
149
112
|
}
|
|
150
113
|
}
|
|
151
|
-
class ContractUnavailable extends InvalidOrder {
|
|
152
|
-
constructor(message) {
|
|
153
|
-
super(message);
|
|
154
|
-
this.name = 'ContractUnavailable';
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
114
|
class OrderNotFound extends InvalidOrder {
|
|
158
115
|
constructor(message) {
|
|
159
116
|
super(message);
|
|
@@ -190,25 +147,36 @@ class DuplicateOrderId extends InvalidOrder {
|
|
|
190
147
|
this.name = 'DuplicateOrderId';
|
|
191
148
|
}
|
|
192
149
|
}
|
|
150
|
+
class ContractUnavailable extends InvalidOrder {
|
|
151
|
+
constructor(message) {
|
|
152
|
+
super(message);
|
|
153
|
+
this.name = 'ContractUnavailable';
|
|
154
|
+
}
|
|
155
|
+
}
|
|
193
156
|
class NotSupported extends ExchangeError {
|
|
194
157
|
constructor(message) {
|
|
195
158
|
super(message);
|
|
196
159
|
this.name = 'NotSupported';
|
|
197
160
|
}
|
|
198
161
|
}
|
|
199
|
-
class
|
|
162
|
+
class ProxyError extends ExchangeError {
|
|
200
163
|
constructor(message) {
|
|
201
164
|
super(message);
|
|
202
|
-
this.name = '
|
|
165
|
+
this.name = 'ProxyError';
|
|
203
166
|
}
|
|
204
167
|
}
|
|
205
|
-
class
|
|
168
|
+
class ExchangeClosedByUser extends ExchangeError {
|
|
169
|
+
constructor(message) {
|
|
170
|
+
super(message);
|
|
171
|
+
this.name = 'ExchangeClosedByUser';
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
class OperationFailed extends BaseError {
|
|
206
175
|
constructor(message) {
|
|
207
176
|
super(message);
|
|
208
177
|
this.name = 'OperationFailed';
|
|
209
178
|
}
|
|
210
179
|
}
|
|
211
|
-
// Network error
|
|
212
180
|
class NetworkError extends OperationFailed {
|
|
213
181
|
constructor(message) {
|
|
214
182
|
super(message);
|
|
@@ -251,14 +219,7 @@ class RequestTimeout extends NetworkError {
|
|
|
251
219
|
this.name = 'RequestTimeout';
|
|
252
220
|
}
|
|
253
221
|
}
|
|
254
|
-
|
|
255
|
-
// export default subclass (
|
|
256
|
-
// // Root class
|
|
257
|
-
// Error,
|
|
258
|
-
// // Derived class hierarchy
|
|
259
|
-
// errorHierarchy
|
|
260
|
-
// )
|
|
261
|
-
const errors = { BaseError, ExchangeClosedByUser, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, ContractUnavailable, NoChange, OperationRejected, OperationFailed, ProxyError };
|
|
222
|
+
var 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, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout };
|
|
262
223
|
|
|
263
224
|
exports.AccountNotEnabled = AccountNotEnabled;
|
|
264
225
|
exports.AccountSuspended = AccountSuspended;
|
|
@@ -10,6 +10,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
10
10
|
// Author: github.com/frosty00
|
|
11
11
|
// Email: carlo.revelli@berkeley.edu
|
|
12
12
|
//
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param array
|
|
16
|
+
* @param x
|
|
17
|
+
*/
|
|
13
18
|
function bisectLeft(array, x) {
|
|
14
19
|
let low = 0;
|
|
15
20
|
let high = array.length - 1;
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -71,6 +71,8 @@ class binance extends binance$1 {
|
|
|
71
71
|
'fetchCanceledOrders': 'emulated',
|
|
72
72
|
'fetchClosedOrder': false,
|
|
73
73
|
'fetchClosedOrders': 'emulated',
|
|
74
|
+
'fetchConvertCurrencies': true,
|
|
75
|
+
'fetchConvertQuote': false,
|
|
74
76
|
'fetchCrossBorrowRate': true,
|
|
75
77
|
'fetchCrossBorrowRates': false,
|
|
76
78
|
'fetchCurrencies': true,
|
|
@@ -970,6 +972,7 @@ class binance extends binance$1 {
|
|
|
970
972
|
},
|
|
971
973
|
'post': {
|
|
972
974
|
'order/oco': 0.2,
|
|
975
|
+
'orderList/oco': 0.2,
|
|
973
976
|
'sor/order': 0.2,
|
|
974
977
|
'sor/order/test': 0.2,
|
|
975
978
|
'order': 0.2,
|
|
@@ -4237,11 +4240,14 @@ class binance extends binance$1 {
|
|
|
4237
4240
|
'interval': this.safeString(this.timeframes, timeframe, timeframe),
|
|
4238
4241
|
'limit': limit,
|
|
4239
4242
|
};
|
|
4243
|
+
const marketId = market['id'];
|
|
4240
4244
|
if (price === 'index') {
|
|
4241
|
-
|
|
4245
|
+
const parts = marketId.split('_');
|
|
4246
|
+
const pair = this.safeString(parts, 0);
|
|
4247
|
+
request['pair'] = pair; // Index price takes this argument instead of symbol
|
|
4242
4248
|
}
|
|
4243
4249
|
else {
|
|
4244
|
-
request['symbol'] =
|
|
4250
|
+
request['symbol'] = marketId;
|
|
4245
4251
|
}
|
|
4246
4252
|
// const duration = this.parseTimeframe (timeframe);
|
|
4247
4253
|
if (since !== undefined) {
|
|
@@ -12586,6 +12592,61 @@ class binance extends binance$1 {
|
|
|
12586
12592
|
const modifications = this.parseMarginModifications(response);
|
|
12587
12593
|
return this.filterBySymbolSinceLimit(modifications, symbol, since, limit);
|
|
12588
12594
|
}
|
|
12595
|
+
async fetchConvertCurrencies(params = {}) {
|
|
12596
|
+
/**
|
|
12597
|
+
* @method
|
|
12598
|
+
* @name binance#fetchConvertCurrencies
|
|
12599
|
+
* @description fetches all available currencies that can be converted
|
|
12600
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#query-order-quantity-precision-per-asset-user_data
|
|
12601
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
12602
|
+
* @returns {object} an associative dictionary of currencies
|
|
12603
|
+
*/
|
|
12604
|
+
await this.loadMarkets();
|
|
12605
|
+
const response = await this.sapiGetConvertAssetInfo(params);
|
|
12606
|
+
//
|
|
12607
|
+
// [
|
|
12608
|
+
// {
|
|
12609
|
+
// "asset": "BTC",
|
|
12610
|
+
// "fraction": 8
|
|
12611
|
+
// },
|
|
12612
|
+
// ]
|
|
12613
|
+
//
|
|
12614
|
+
const result = {};
|
|
12615
|
+
for (let i = 0; i < response.length; i++) {
|
|
12616
|
+
const entry = response[i];
|
|
12617
|
+
const id = this.safeString(entry, 'asset');
|
|
12618
|
+
const code = this.safeCurrencyCode(id);
|
|
12619
|
+
result[code] = {
|
|
12620
|
+
'info': entry,
|
|
12621
|
+
'id': id,
|
|
12622
|
+
'code': code,
|
|
12623
|
+
'networks': undefined,
|
|
12624
|
+
'type': undefined,
|
|
12625
|
+
'name': undefined,
|
|
12626
|
+
'active': undefined,
|
|
12627
|
+
'deposit': undefined,
|
|
12628
|
+
'withdraw': undefined,
|
|
12629
|
+
'fee': undefined,
|
|
12630
|
+
'precision': this.safeInteger(entry, 'fraction'),
|
|
12631
|
+
'limits': {
|
|
12632
|
+
'amount': {
|
|
12633
|
+
'min': undefined,
|
|
12634
|
+
'max': undefined,
|
|
12635
|
+
},
|
|
12636
|
+
'withdraw': {
|
|
12637
|
+
'min': undefined,
|
|
12638
|
+
'max': undefined,
|
|
12639
|
+
},
|
|
12640
|
+
'deposit': {
|
|
12641
|
+
'min': undefined,
|
|
12642
|
+
'max': undefined,
|
|
12643
|
+
},
|
|
12644
|
+
},
|
|
12645
|
+
'created': undefined,
|
|
12646
|
+
};
|
|
12647
|
+
}
|
|
12648
|
+
return result;
|
|
12649
|
+
}
|
|
12589
12650
|
}
|
|
12590
12651
|
|
|
12591
12652
|
module.exports = binance;
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -63,6 +63,8 @@ class bitget extends bitget$1 {
|
|
|
63
63
|
'fetchCanceledAndClosedOrders': true,
|
|
64
64
|
'fetchCanceledOrders': true,
|
|
65
65
|
'fetchClosedOrders': true,
|
|
66
|
+
'fetchConvertCurrencies': true,
|
|
67
|
+
'fetchConvertQuote': true,
|
|
66
68
|
'fetchCrossBorrowRate': true,
|
|
67
69
|
'fetchCrossBorrowRates': false,
|
|
68
70
|
'fetchCurrencies': true,
|
|
@@ -8442,6 +8444,143 @@ class bitget extends bitget$1 {
|
|
|
8442
8444
|
'marginMode': marginType,
|
|
8443
8445
|
};
|
|
8444
8446
|
}
|
|
8447
|
+
async fetchConvertQuote(fromCode, toCode, amount = undefined, params = {}) {
|
|
8448
|
+
/**
|
|
8449
|
+
* @method
|
|
8450
|
+
* @name bitget#fetchConvertQuote
|
|
8451
|
+
* @description fetch a quote for converting from one currency to another
|
|
8452
|
+
* @see https://www.bitget.com/api-doc/common/convert/Get-Quoted-Price
|
|
8453
|
+
* @param {string} fromCode the currency that you want to sell and convert from
|
|
8454
|
+
* @param {string} toCode the currency that you want to buy and convert into
|
|
8455
|
+
* @param {float} [amount] how much you want to trade in units of the from currency
|
|
8456
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8457
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
8458
|
+
*/
|
|
8459
|
+
await this.loadMarkets();
|
|
8460
|
+
const request = {
|
|
8461
|
+
'fromCoin': fromCode.toUpperCase(),
|
|
8462
|
+
'toCoin': toCode.toUpperCase(),
|
|
8463
|
+
'fromCoinSize': this.numberToString(amount),
|
|
8464
|
+
};
|
|
8465
|
+
const response = await this.privateConvertGetV2ConvertQuotedPrice(this.extend(request, params));
|
|
8466
|
+
//
|
|
8467
|
+
// {
|
|
8468
|
+
// "code": "00000",
|
|
8469
|
+
// "msg": "success",
|
|
8470
|
+
// "requestTime": 1712121940158,
|
|
8471
|
+
// "data": {
|
|
8472
|
+
// "fromCoin": "USDT",
|
|
8473
|
+
// "fromCoinSize": "5",
|
|
8474
|
+
// "cnvtPrice": "0.9993007892377704",
|
|
8475
|
+
// "toCoin": "USDC",
|
|
8476
|
+
// "toCoinSize": "4.99650394",
|
|
8477
|
+
// "traceId": "1159288930228187140",
|
|
8478
|
+
// "fee": "0"
|
|
8479
|
+
// }
|
|
8480
|
+
// }
|
|
8481
|
+
//
|
|
8482
|
+
const data = this.safeDict(response, 'data', {});
|
|
8483
|
+
const fromCurrencyId = this.safeString(data, 'fromCoin', fromCode);
|
|
8484
|
+
const fromCurrency = this.currency(fromCurrencyId);
|
|
8485
|
+
const toCurrencyId = this.safeString(data, 'toCoin', toCode);
|
|
8486
|
+
const toCurrency = this.currency(toCurrencyId);
|
|
8487
|
+
return this.parseConversion(data, fromCurrency, toCurrency);
|
|
8488
|
+
}
|
|
8489
|
+
parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
|
|
8490
|
+
//
|
|
8491
|
+
// fetchConvertQuote
|
|
8492
|
+
//
|
|
8493
|
+
// {
|
|
8494
|
+
// "fromCoin": "USDT",
|
|
8495
|
+
// "fromCoinSize": "5",
|
|
8496
|
+
// "cnvtPrice": "0.9993007892377704",
|
|
8497
|
+
// "toCoin": "USDC",
|
|
8498
|
+
// "toCoinSize": "4.99650394",
|
|
8499
|
+
// "traceId": "1159288930228187140",
|
|
8500
|
+
// "fee": "0"
|
|
8501
|
+
// }
|
|
8502
|
+
//
|
|
8503
|
+
const timestamp = this.safeInteger(conversion, 'ts');
|
|
8504
|
+
const fromCoin = this.safeString(conversion, 'fromCoin');
|
|
8505
|
+
const fromCode = this.safeCurrencyCode(fromCoin, fromCurrency);
|
|
8506
|
+
const to = this.safeString(conversion, 'toCoin');
|
|
8507
|
+
const toCode = this.safeCurrencyCode(to, toCurrency);
|
|
8508
|
+
return {
|
|
8509
|
+
'info': conversion,
|
|
8510
|
+
'timestamp': timestamp,
|
|
8511
|
+
'datetime': this.iso8601(timestamp),
|
|
8512
|
+
'id': this.safeString(conversion, 'traceId'),
|
|
8513
|
+
'fromCurrency': fromCode,
|
|
8514
|
+
'fromAmount': this.safeNumber(conversion, 'fromCoinSize'),
|
|
8515
|
+
'toCurrency': toCode,
|
|
8516
|
+
'toAmount': this.safeNumber(conversion, 'toCoinSize'),
|
|
8517
|
+
'price': this.safeNumber(conversion, 'cnvtPrice'),
|
|
8518
|
+
'fee': this.safeNumber(conversion, 'fee'),
|
|
8519
|
+
};
|
|
8520
|
+
}
|
|
8521
|
+
async fetchConvertCurrencies(params = {}) {
|
|
8522
|
+
/**
|
|
8523
|
+
* @method
|
|
8524
|
+
* @name bitget#fetchConvertCurrencies
|
|
8525
|
+
* @description fetches all available currencies that can be converted
|
|
8526
|
+
* @see https://www.bitget.com/api-doc/common/convert/Get-Convert-Currencies
|
|
8527
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8528
|
+
* @returns {object} an associative dictionary of currencies
|
|
8529
|
+
*/
|
|
8530
|
+
await this.loadMarkets();
|
|
8531
|
+
const response = await this.privateConvertGetV2ConvertCurrencies(params);
|
|
8532
|
+
//
|
|
8533
|
+
// {
|
|
8534
|
+
// "code": "00000",
|
|
8535
|
+
// "msg": "success",
|
|
8536
|
+
// "requestTime": 1712121755897,
|
|
8537
|
+
// "data": [
|
|
8538
|
+
// {
|
|
8539
|
+
// "coin": "BTC",
|
|
8540
|
+
// "available": "0.00009850",
|
|
8541
|
+
// "maxAmount": "0.756266",
|
|
8542
|
+
// "minAmount": "0.00001"
|
|
8543
|
+
// },
|
|
8544
|
+
// ]
|
|
8545
|
+
// }
|
|
8546
|
+
//
|
|
8547
|
+
const result = {};
|
|
8548
|
+
const data = this.safeList(response, 'data', []);
|
|
8549
|
+
for (let i = 0; i < data.length; i++) {
|
|
8550
|
+
const entry = data[i];
|
|
8551
|
+
const id = this.safeString(entry, 'coin');
|
|
8552
|
+
const code = this.safeCurrencyCode(id);
|
|
8553
|
+
result[code] = {
|
|
8554
|
+
'info': entry,
|
|
8555
|
+
'id': id,
|
|
8556
|
+
'code': code,
|
|
8557
|
+
'networks': undefined,
|
|
8558
|
+
'type': undefined,
|
|
8559
|
+
'name': undefined,
|
|
8560
|
+
'active': undefined,
|
|
8561
|
+
'deposit': undefined,
|
|
8562
|
+
'withdraw': this.safeNumber(entry, 'available'),
|
|
8563
|
+
'fee': undefined,
|
|
8564
|
+
'precision': undefined,
|
|
8565
|
+
'limits': {
|
|
8566
|
+
'amount': {
|
|
8567
|
+
'min': this.safeNumber(entry, 'minAmount'),
|
|
8568
|
+
'max': this.safeNumber(entry, 'maxAmount'),
|
|
8569
|
+
},
|
|
8570
|
+
'withdraw': {
|
|
8571
|
+
'min': undefined,
|
|
8572
|
+
'max': undefined,
|
|
8573
|
+
},
|
|
8574
|
+
'deposit': {
|
|
8575
|
+
'min': undefined,
|
|
8576
|
+
'max': undefined,
|
|
8577
|
+
},
|
|
8578
|
+
},
|
|
8579
|
+
'created': undefined,
|
|
8580
|
+
};
|
|
8581
|
+
}
|
|
8582
|
+
return result;
|
|
8583
|
+
}
|
|
8445
8584
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
8446
8585
|
if (!response) {
|
|
8447
8586
|
return undefined; // fallback to default error handler
|
package/dist/cjs/src/bitstamp.js
CHANGED
|
@@ -357,6 +357,12 @@ class bitstamp extends bitstamp$1 {
|
|
|
357
357
|
'blur_address/': 1,
|
|
358
358
|
'vext_withdrawal/': 1,
|
|
359
359
|
'vext_address/': 1,
|
|
360
|
+
'cspr_withdrawal/': 1,
|
|
361
|
+
'cspr_address/': 1,
|
|
362
|
+
'vchf_withdrawal/': 1,
|
|
363
|
+
'vchf_address/': 1,
|
|
364
|
+
'veur_withdrawal/': 1,
|
|
365
|
+
'veur_address/': 1,
|
|
360
366
|
},
|
|
361
367
|
},
|
|
362
368
|
},
|
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -1088,8 +1088,8 @@ class coinex extends coinex$1 {
|
|
|
1088
1088
|
* @method
|
|
1089
1089
|
* @name coinex#fetchOrderBook
|
|
1090
1090
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
1091
|
-
* @see https://
|
|
1092
|
-
* @see https://
|
|
1091
|
+
* @see https://docs.coinex.com/api/v2/spot/market/http/list-market-depth
|
|
1092
|
+
* @see https://docs.coinex.com/api/v2/futures/market/http/list-market-depth
|
|
1093
1093
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
1094
1094
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
1095
1095
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -1101,65 +1101,71 @@ class coinex extends coinex$1 {
|
|
|
1101
1101
|
limit = 20; // default
|
|
1102
1102
|
}
|
|
1103
1103
|
const request = {
|
|
1104
|
-
'market':
|
|
1105
|
-
'
|
|
1106
|
-
'
|
|
1104
|
+
'market': market['id'],
|
|
1105
|
+
'limit': limit,
|
|
1106
|
+
'interval': '0',
|
|
1107
1107
|
};
|
|
1108
1108
|
let response = undefined;
|
|
1109
1109
|
if (market['swap']) {
|
|
1110
|
-
response = await this.
|
|
1110
|
+
response = await this.v2PublicGetFuturesDepth(this.extend(request, params));
|
|
1111
|
+
//
|
|
1112
|
+
// {
|
|
1113
|
+
// "code": 0,
|
|
1114
|
+
// "data": {
|
|
1115
|
+
// "depth": {
|
|
1116
|
+
// "asks": [
|
|
1117
|
+
// ["70851.94", "0.2119"],
|
|
1118
|
+
// ["70851.95", "0.0004"],
|
|
1119
|
+
// ["70851.96", "0.0004"]
|
|
1120
|
+
// ],
|
|
1121
|
+
// "bids": [
|
|
1122
|
+
// ["70851.93", "1.0314"],
|
|
1123
|
+
// ["70850.93", "0.0021"],
|
|
1124
|
+
// ["70850.42", "0.0306"]
|
|
1125
|
+
// ],
|
|
1126
|
+
// "checksum": 2956436260,
|
|
1127
|
+
// "last": "70851.94",
|
|
1128
|
+
// "updated_at": 1712824003252
|
|
1129
|
+
// },
|
|
1130
|
+
// "is_full": true,
|
|
1131
|
+
// "market": "BTCUSDT"
|
|
1132
|
+
// },
|
|
1133
|
+
// "message": "OK"
|
|
1134
|
+
// }
|
|
1135
|
+
//
|
|
1111
1136
|
}
|
|
1112
1137
|
else {
|
|
1113
|
-
response = await this.
|
|
1138
|
+
response = await this.v2PublicGetSpotDepth(this.extend(request, params));
|
|
1139
|
+
//
|
|
1140
|
+
// {
|
|
1141
|
+
// "code": 0,
|
|
1142
|
+
// "data": {
|
|
1143
|
+
// "depth": {
|
|
1144
|
+
// "asks": [
|
|
1145
|
+
// ["70875.31", "0.28670282"],
|
|
1146
|
+
// ["70875.32", "0.31008114"],
|
|
1147
|
+
// ["70875.42", "0.05876653"]
|
|
1148
|
+
// ],
|
|
1149
|
+
// "bids": [
|
|
1150
|
+
// ["70855.3", "0.00632222"],
|
|
1151
|
+
// ["70855.29", "0.36216834"],
|
|
1152
|
+
// ["70855.17", "0.10166802"]
|
|
1153
|
+
// ],
|
|
1154
|
+
// "checksum": 2313816665,
|
|
1155
|
+
// "last": "70857.19",
|
|
1156
|
+
// "updated_at": 1712823790987
|
|
1157
|
+
// },
|
|
1158
|
+
// "is_full": true,
|
|
1159
|
+
// "market": "BTCUSDT"
|
|
1160
|
+
// },
|
|
1161
|
+
// "message": "OK"
|
|
1162
|
+
// }
|
|
1163
|
+
//
|
|
1114
1164
|
}
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
// "code": 0,
|
|
1120
|
-
// "data": {
|
|
1121
|
-
// "asks": [
|
|
1122
|
-
// ["41056.33", "0.31727613"],
|
|
1123
|
-
// ["41056.34", "1.05657294"],
|
|
1124
|
-
// ["41056.35", "0.02346648"]
|
|
1125
|
-
// ],
|
|
1126
|
-
// "bids": [
|
|
1127
|
-
// ["41050.61", "0.40618608"],
|
|
1128
|
-
// ["41046.98", "0.13800000"],
|
|
1129
|
-
// ["41046.56", "0.22579234"]
|
|
1130
|
-
// ],
|
|
1131
|
-
// "last": "41050.61",
|
|
1132
|
-
// "time": 1650573220346
|
|
1133
|
-
// },
|
|
1134
|
-
// "message": "OK"
|
|
1135
|
-
// }
|
|
1136
|
-
//
|
|
1137
|
-
// Swap
|
|
1138
|
-
//
|
|
1139
|
-
// {
|
|
1140
|
-
// "code": 0,
|
|
1141
|
-
// "data": {
|
|
1142
|
-
// "asks": [
|
|
1143
|
-
// ["40620.90", "0.0384"],
|
|
1144
|
-
// ["40625.50", "0.0219"],
|
|
1145
|
-
// ["40625.90", "0.3506"]
|
|
1146
|
-
// ],
|
|
1147
|
-
// "bids": [
|
|
1148
|
-
// ["40620.89", "19.6861"],
|
|
1149
|
-
// ["40620.80", "0.0012"],
|
|
1150
|
-
// ["40619.87", "0.0365"]
|
|
1151
|
-
// ],
|
|
1152
|
-
// "last": "40620.89",
|
|
1153
|
-
// "time": 1650587672406,
|
|
1154
|
-
// "sign_price": "40619.32",
|
|
1155
|
-
// "index_price": "40609.93"
|
|
1156
|
-
// },
|
|
1157
|
-
// "message": "OK"
|
|
1158
|
-
// }
|
|
1159
|
-
//
|
|
1160
|
-
const result = this.safeValue(response, 'data', {});
|
|
1161
|
-
const timestamp = this.safeInteger(result, 'time');
|
|
1162
|
-
return this.parseOrderBook(result, symbol, timestamp);
|
|
1165
|
+
const data = this.safeDict(response, 'data', {});
|
|
1166
|
+
const depth = this.safeDict(data, 'depth', {});
|
|
1167
|
+
const timestamp = this.safeInteger(depth, 'updated_at');
|
|
1168
|
+
return this.parseOrderBook(depth, symbol, timestamp);
|
|
1163
1169
|
}
|
|
1164
1170
|
parseTrade(trade, market = undefined) {
|
|
1165
1171
|
//
|
package/dist/cjs/src/gemini.js
CHANGED
|
@@ -683,7 +683,8 @@ class gemini extends gemini$1 {
|
|
|
683
683
|
for (let i = 0; i < quoteQurrencies.length; i++) {
|
|
684
684
|
const quoteCurrency = quoteQurrencies[i];
|
|
685
685
|
if (marketIdWithoutPerp.endsWith(quoteCurrency)) {
|
|
686
|
-
|
|
686
|
+
const quoteLength = this.parseToInt(-1 * quoteCurrency.length);
|
|
687
|
+
baseId = marketIdWithoutPerp.slice(0, quoteLength);
|
|
687
688
|
quoteId = quoteCurrency;
|
|
688
689
|
if (isPerp) {
|
|
689
690
|
settleId = quoteCurrency; // always same
|