ccxt 4.3.57 → 4.3.59
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 +4 -4
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +4 -2
- package/dist/cjs/src/alpaca.js +5 -1
- package/dist/cjs/src/base/Exchange.js +4 -4
- package/dist/cjs/src/base/errors.js +22 -22
- package/dist/cjs/src/bigone.js +21 -1
- package/dist/cjs/src/bingx.js +131 -26
- package/dist/cjs/src/bitmart.js +1 -0
- package/dist/cjs/src/btcbox.js +149 -7
- package/dist/cjs/src/bybit.js +2 -2
- package/dist/cjs/src/coinmate.js +28 -35
- package/dist/cjs/src/coinone.js +1 -1
- package/dist/cjs/src/deribit.js +15 -1
- package/dist/cjs/src/digifinex.js +32 -7
- package/dist/cjs/src/gate.js +24 -18
- package/dist/cjs/src/htx.js +10 -8
- package/dist/cjs/src/hyperliquid.js +107 -1
- package/dist/cjs/src/kucoin.js +3 -0
- package/dist/cjs/src/latoken.js +5 -1
- package/dist/cjs/src/mexc.js +11 -11
- package/dist/cjs/src/okx.js +3 -0
- package/dist/cjs/src/pro/binance.js +11 -13
- package/dist/cjs/src/pro/bingx.js +11 -8
- package/dist/cjs/src/pro/okx.js +3 -3
- package/dist/cjs/src/pro/xt.js +1108 -0
- package/dist/cjs/src/upbit.js +148 -49
- package/dist/cjs/src/woo.js +1 -1
- package/dist/cjs/src/xt.js +72 -7
- package/js/ccxt.d.ts +6 -3
- package/js/ccxt.js +5 -3
- package/js/src/abstract/bitmart.d.ts +1 -0
- package/js/src/abstract/btcbox.d.ts +1 -0
- package/js/src/abstract/kucoin.d.ts +1 -0
- package/js/src/abstract/kucoinfutures.d.ts +1 -0
- package/js/src/abstract/upbit.d.ts +3 -0
- package/js/src/abstract/xt.d.ts +1 -0
- package/js/src/alpaca.d.ts +1 -1
- package/js/src/alpaca.js +5 -1
- package/js/src/base/Exchange.d.ts +3 -3
- package/js/src/base/Exchange.js +5 -5
- package/js/src/base/errorHierarchy.d.ts +5 -5
- package/js/src/base/errorHierarchy.js +5 -5
- package/js/src/base/errors.d.ts +15 -15
- package/js/src/base/errors.js +22 -22
- package/js/src/bigone.d.ts +1 -1
- package/js/src/bigone.js +21 -1
- package/js/src/bingx.js +131 -26
- package/js/src/bitmart.js +1 -0
- package/js/src/btcbox.d.ts +4 -1
- package/js/src/btcbox.js +149 -7
- package/js/src/bybit.js +2 -2
- package/js/src/coinmate.js +28 -35
- package/js/src/coinone.js +1 -1
- package/js/src/deribit.d.ts +1 -1
- package/js/src/deribit.js +15 -1
- package/js/src/digifinex.d.ts +3 -2
- package/js/src/digifinex.js +32 -7
- package/js/src/gate.js +24 -18
- package/js/src/htx.js +10 -8
- package/js/src/hyperliquid.d.ts +3 -1
- package/js/src/hyperliquid.js +107 -1
- package/js/src/kucoin.js +3 -0
- package/js/src/latoken.d.ts +1 -1
- package/js/src/latoken.js +5 -1
- package/js/src/mexc.js +11 -11
- package/js/src/okx.js +3 -0
- package/js/src/pro/binance.js +11 -13
- package/js/src/pro/bingx.js +11 -8
- package/js/src/pro/bitmart.d.ts +3 -3
- package/js/src/pro/bitopro.d.ts +2 -2
- package/js/src/pro/coincheck.d.ts +2 -2
- package/js/src/pro/coinone.d.ts +2 -2
- package/js/src/pro/hyperliquid.d.ts +2 -2
- package/js/src/pro/okx.js +3 -3
- package/js/src/pro/xt.d.ts +31 -0
- package/js/src/pro/xt.js +1109 -0
- package/js/src/upbit.d.ts +0 -1
- package/js/src/upbit.js +148 -49
- package/js/src/woo.js +2 -2
- package/js/src/xt.js +72 -7
- package/package.json +1 -1
package/js/src/base/Exchange.js
CHANGED
|
@@ -11,7 +11,7 @@ const { isNode, deepExtend, extend, clone, flatten, unique, indexBy, sortBy, sor
|
|
|
11
11
|
import { keys as keysFunc, values as valuesFunc, vwap as vwapFunc } from './functions.js';
|
|
12
12
|
// import exceptions from "./errors.js"
|
|
13
13
|
import { // eslint-disable-line object-curly-newline
|
|
14
|
-
ExchangeError, BadSymbol, NullResponse, InvalidAddress, InvalidOrder, NotSupported, BadResponse, AuthenticationError, DDoSProtection, RequestTimeout, NetworkError,
|
|
14
|
+
ExchangeError, BadSymbol, NullResponse, InvalidAddress, InvalidOrder, NotSupported, BadResponse, AuthenticationError, DDoSProtection, RequestTimeout, NetworkError, InvalidProxySettings, ExchangeNotAvailable, ArgumentsRequired, RateLimitExceeded, BadRequest, ExchangeClosedByUser } from "./errors.js";
|
|
15
15
|
import { Precise } from './Precise.js';
|
|
16
16
|
//-----------------------------------------------------------------------------
|
|
17
17
|
import WsClient from './ws/WsClient.js';
|
|
@@ -1689,7 +1689,7 @@ export default class Exchange {
|
|
|
1689
1689
|
const length = usedProxies.length;
|
|
1690
1690
|
if (length > 1) {
|
|
1691
1691
|
const joinedProxyNames = usedProxies.join(',');
|
|
1692
|
-
throw new
|
|
1692
|
+
throw new InvalidProxySettings(this.id + ' you have multiple conflicting proxy settings (' + joinedProxyNames + '), please use only one from : proxyUrl, proxy_url, proxyUrlCallback, proxy_url_callback');
|
|
1693
1693
|
}
|
|
1694
1694
|
return proxyUrl;
|
|
1695
1695
|
}
|
|
@@ -1753,7 +1753,7 @@ export default class Exchange {
|
|
|
1753
1753
|
const length = usedProxies.length;
|
|
1754
1754
|
if (length > 1) {
|
|
1755
1755
|
const joinedProxyNames = usedProxies.join(',');
|
|
1756
|
-
throw new
|
|
1756
|
+
throw new InvalidProxySettings(this.id + ' you have multiple conflicting proxy settings (' + joinedProxyNames + '), please use only one from: httpProxy, httpsProxy, httpProxyCallback, httpsProxyCallback, socksProxy, socksProxyCallback');
|
|
1757
1757
|
}
|
|
1758
1758
|
return [httpProxy, httpsProxy, socksProxy];
|
|
1759
1759
|
}
|
|
@@ -1793,13 +1793,13 @@ export default class Exchange {
|
|
|
1793
1793
|
const length = usedProxies.length;
|
|
1794
1794
|
if (length > 1) {
|
|
1795
1795
|
const joinedProxyNames = usedProxies.join(',');
|
|
1796
|
-
throw new
|
|
1796
|
+
throw new InvalidProxySettings(this.id + ' you have multiple conflicting proxy settings (' + joinedProxyNames + '), please use only one from: wsProxy, wssProxy, wsSocksProxy');
|
|
1797
1797
|
}
|
|
1798
1798
|
return [wsProxy, wssProxy, wsSocksProxy];
|
|
1799
1799
|
}
|
|
1800
1800
|
checkConflictingProxies(proxyAgentSet, proxyUrlSet) {
|
|
1801
1801
|
if (proxyAgentSet && proxyUrlSet) {
|
|
1802
|
-
throw new
|
|
1802
|
+
throw new InvalidProxySettings(this.id + ' you have multiple conflicting proxy settings, please use only one from : proxyUrl, httpProxy, httpsProxy, socksProxy');
|
|
1803
1803
|
}
|
|
1804
1804
|
}
|
|
1805
1805
|
findMessageHashes(client, element) {
|
|
@@ -17,9 +17,6 @@ declare const errorHierarchy: {
|
|
|
17
17
|
};
|
|
18
18
|
MarketClosed: {};
|
|
19
19
|
};
|
|
20
|
-
BadResponse: {
|
|
21
|
-
NullResponse: {};
|
|
22
|
-
};
|
|
23
20
|
InsufficientFunds: {};
|
|
24
21
|
InvalidAddress: {
|
|
25
22
|
AddressPending: {};
|
|
@@ -27,14 +24,13 @@ declare const errorHierarchy: {
|
|
|
27
24
|
InvalidOrder: {
|
|
28
25
|
OrderNotFound: {};
|
|
29
26
|
OrderNotCached: {};
|
|
30
|
-
CancelPending: {};
|
|
31
27
|
OrderImmediatelyFillable: {};
|
|
32
28
|
OrderNotFillable: {};
|
|
33
29
|
DuplicateOrderId: {};
|
|
34
30
|
ContractUnavailable: {};
|
|
35
31
|
};
|
|
36
32
|
NotSupported: {};
|
|
37
|
-
|
|
33
|
+
InvalidProxySettings: {};
|
|
38
34
|
ExchangeClosedByUser: {};
|
|
39
35
|
};
|
|
40
36
|
OperationFailed: {
|
|
@@ -47,6 +43,10 @@ declare const errorHierarchy: {
|
|
|
47
43
|
InvalidNonce: {};
|
|
48
44
|
RequestTimeout: {};
|
|
49
45
|
};
|
|
46
|
+
BadResponse: {
|
|
47
|
+
NullResponse: {};
|
|
48
|
+
};
|
|
49
|
+
CancelPending: {};
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
52
|
};
|
|
@@ -23,9 +23,6 @@ const errorHierarchy = {
|
|
|
23
23
|
},
|
|
24
24
|
'MarketClosed': {},
|
|
25
25
|
},
|
|
26
|
-
'BadResponse': {
|
|
27
|
-
'NullResponse': {},
|
|
28
|
-
},
|
|
29
26
|
'InsufficientFunds': {},
|
|
30
27
|
'InvalidAddress': {
|
|
31
28
|
'AddressPending': {},
|
|
@@ -33,14 +30,13 @@ const errorHierarchy = {
|
|
|
33
30
|
'InvalidOrder': {
|
|
34
31
|
'OrderNotFound': {},
|
|
35
32
|
'OrderNotCached': {},
|
|
36
|
-
'CancelPending': {},
|
|
37
33
|
'OrderImmediatelyFillable': {},
|
|
38
34
|
'OrderNotFillable': {},
|
|
39
35
|
'DuplicateOrderId': {},
|
|
40
36
|
'ContractUnavailable': {},
|
|
41
37
|
},
|
|
42
38
|
'NotSupported': {},
|
|
43
|
-
'
|
|
39
|
+
'InvalidProxySettings': {},
|
|
44
40
|
'ExchangeClosedByUser': {},
|
|
45
41
|
},
|
|
46
42
|
'OperationFailed': {
|
|
@@ -53,6 +49,10 @@ const errorHierarchy = {
|
|
|
53
49
|
'InvalidNonce': {},
|
|
54
50
|
'RequestTimeout': {},
|
|
55
51
|
},
|
|
52
|
+
'BadResponse': {
|
|
53
|
+
'NullResponse': {},
|
|
54
|
+
},
|
|
55
|
+
'CancelPending': {},
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
};
|
package/js/src/base/errors.d.ts
CHANGED
|
@@ -37,12 +37,6 @@ declare class MarginModeAlreadySet extends NoChange {
|
|
|
37
37
|
declare class MarketClosed extends OperationRejected {
|
|
38
38
|
constructor(message: string);
|
|
39
39
|
}
|
|
40
|
-
declare class BadResponse extends ExchangeError {
|
|
41
|
-
constructor(message: string);
|
|
42
|
-
}
|
|
43
|
-
declare class NullResponse extends BadResponse {
|
|
44
|
-
constructor(message: string);
|
|
45
|
-
}
|
|
46
40
|
declare class InsufficientFunds extends ExchangeError {
|
|
47
41
|
constructor(message: string);
|
|
48
42
|
}
|
|
@@ -61,9 +55,6 @@ declare class OrderNotFound extends InvalidOrder {
|
|
|
61
55
|
declare class OrderNotCached extends InvalidOrder {
|
|
62
56
|
constructor(message: string);
|
|
63
57
|
}
|
|
64
|
-
declare class CancelPending extends InvalidOrder {
|
|
65
|
-
constructor(message: string);
|
|
66
|
-
}
|
|
67
58
|
declare class OrderImmediatelyFillable extends InvalidOrder {
|
|
68
59
|
constructor(message: string);
|
|
69
60
|
}
|
|
@@ -79,7 +70,7 @@ declare class ContractUnavailable extends InvalidOrder {
|
|
|
79
70
|
declare class NotSupported extends ExchangeError {
|
|
80
71
|
constructor(message: string);
|
|
81
72
|
}
|
|
82
|
-
declare class
|
|
73
|
+
declare class InvalidProxySettings extends ExchangeError {
|
|
83
74
|
constructor(message: string);
|
|
84
75
|
}
|
|
85
76
|
declare class ExchangeClosedByUser extends ExchangeError {
|
|
@@ -109,7 +100,16 @@ declare class InvalidNonce extends NetworkError {
|
|
|
109
100
|
declare class RequestTimeout extends NetworkError {
|
|
110
101
|
constructor(message: string);
|
|
111
102
|
}
|
|
112
|
-
|
|
103
|
+
declare class BadResponse extends OperationFailed {
|
|
104
|
+
constructor(message: string);
|
|
105
|
+
}
|
|
106
|
+
declare class NullResponse extends BadResponse {
|
|
107
|
+
constructor(message: string);
|
|
108
|
+
}
|
|
109
|
+
declare class CancelPending extends OperationFailed {
|
|
110
|
+
constructor(message: string);
|
|
111
|
+
}
|
|
112
|
+
export { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, BadResponse, NullResponse, CancelPending };
|
|
113
113
|
declare const _default: {
|
|
114
114
|
BaseError: typeof BaseError;
|
|
115
115
|
ExchangeError: typeof ExchangeError;
|
|
@@ -124,21 +124,18 @@ declare const _default: {
|
|
|
124
124
|
NoChange: typeof NoChange;
|
|
125
125
|
MarginModeAlreadySet: typeof MarginModeAlreadySet;
|
|
126
126
|
MarketClosed: typeof MarketClosed;
|
|
127
|
-
BadResponse: typeof BadResponse;
|
|
128
|
-
NullResponse: typeof NullResponse;
|
|
129
127
|
InsufficientFunds: typeof InsufficientFunds;
|
|
130
128
|
InvalidAddress: typeof InvalidAddress;
|
|
131
129
|
AddressPending: typeof AddressPending;
|
|
132
130
|
InvalidOrder: typeof InvalidOrder;
|
|
133
131
|
OrderNotFound: typeof OrderNotFound;
|
|
134
132
|
OrderNotCached: typeof OrderNotCached;
|
|
135
|
-
CancelPending: typeof CancelPending;
|
|
136
133
|
OrderImmediatelyFillable: typeof OrderImmediatelyFillable;
|
|
137
134
|
OrderNotFillable: typeof OrderNotFillable;
|
|
138
135
|
DuplicateOrderId: typeof DuplicateOrderId;
|
|
139
136
|
ContractUnavailable: typeof ContractUnavailable;
|
|
140
137
|
NotSupported: typeof NotSupported;
|
|
141
|
-
|
|
138
|
+
InvalidProxySettings: typeof InvalidProxySettings;
|
|
142
139
|
ExchangeClosedByUser: typeof ExchangeClosedByUser;
|
|
143
140
|
OperationFailed: typeof OperationFailed;
|
|
144
141
|
NetworkError: typeof NetworkError;
|
|
@@ -148,5 +145,8 @@ declare const _default: {
|
|
|
148
145
|
OnMaintenance: typeof OnMaintenance;
|
|
149
146
|
InvalidNonce: typeof InvalidNonce;
|
|
150
147
|
RequestTimeout: typeof RequestTimeout;
|
|
148
|
+
BadResponse: typeof BadResponse;
|
|
149
|
+
NullResponse: typeof NullResponse;
|
|
150
|
+
CancelPending: typeof CancelPending;
|
|
151
151
|
};
|
|
152
152
|
export default _default;
|
package/js/src/base/errors.js
CHANGED
|
@@ -83,18 +83,6 @@ class MarketClosed extends OperationRejected {
|
|
|
83
83
|
this.name = 'MarketClosed';
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
class BadResponse extends ExchangeError {
|
|
87
|
-
constructor(message) {
|
|
88
|
-
super(message);
|
|
89
|
-
this.name = 'BadResponse';
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
class NullResponse extends BadResponse {
|
|
93
|
-
constructor(message) {
|
|
94
|
-
super(message);
|
|
95
|
-
this.name = 'NullResponse';
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
86
|
class InsufficientFunds extends ExchangeError {
|
|
99
87
|
constructor(message) {
|
|
100
88
|
super(message);
|
|
@@ -131,12 +119,6 @@ class OrderNotCached extends InvalidOrder {
|
|
|
131
119
|
this.name = 'OrderNotCached';
|
|
132
120
|
}
|
|
133
121
|
}
|
|
134
|
-
class CancelPending extends InvalidOrder {
|
|
135
|
-
constructor(message) {
|
|
136
|
-
super(message);
|
|
137
|
-
this.name = 'CancelPending';
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
122
|
class OrderImmediatelyFillable extends InvalidOrder {
|
|
141
123
|
constructor(message) {
|
|
142
124
|
super(message);
|
|
@@ -167,10 +149,10 @@ class NotSupported extends ExchangeError {
|
|
|
167
149
|
this.name = 'NotSupported';
|
|
168
150
|
}
|
|
169
151
|
}
|
|
170
|
-
class
|
|
152
|
+
class InvalidProxySettings extends ExchangeError {
|
|
171
153
|
constructor(message) {
|
|
172
154
|
super(message);
|
|
173
|
-
this.name = '
|
|
155
|
+
this.name = 'InvalidProxySettings';
|
|
174
156
|
}
|
|
175
157
|
}
|
|
176
158
|
class ExchangeClosedByUser extends ExchangeError {
|
|
@@ -227,5 +209,23 @@ class RequestTimeout extends NetworkError {
|
|
|
227
209
|
this.name = 'RequestTimeout';
|
|
228
210
|
}
|
|
229
211
|
}
|
|
230
|
-
|
|
231
|
-
|
|
212
|
+
class BadResponse extends OperationFailed {
|
|
213
|
+
constructor(message) {
|
|
214
|
+
super(message);
|
|
215
|
+
this.name = 'BadResponse';
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
class NullResponse extends BadResponse {
|
|
219
|
+
constructor(message) {
|
|
220
|
+
super(message);
|
|
221
|
+
this.name = 'NullResponse';
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
class CancelPending extends OperationFailed {
|
|
225
|
+
constructor(message) {
|
|
226
|
+
super(message);
|
|
227
|
+
this.name = 'CancelPending';
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
export { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, BadResponse, NullResponse, CancelPending };
|
|
231
|
+
export default { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, BadResponse, NullResponse, CancelPending };
|
package/js/src/bigone.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export default class bigone extends Exchange {
|
|
|
26
26
|
createMarketBuyOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
|
|
27
27
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
|
28
28
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
29
|
-
cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
|
|
29
|
+
cancelAllOrders(symbol?: Str, params?: {}): Promise<any[]>;
|
|
30
30
|
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
31
31
|
fetchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
32
32
|
fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
package/js/src/bigone.js
CHANGED
|
@@ -1624,7 +1624,27 @@ export default class bigone extends Exchange {
|
|
|
1624
1624
|
// }
|
|
1625
1625
|
// }
|
|
1626
1626
|
//
|
|
1627
|
-
|
|
1627
|
+
const data = this.safeDict(response, 'data', {});
|
|
1628
|
+
const cancelled = this.safeList(data, 'cancelled', []);
|
|
1629
|
+
const failed = this.safeList(data, 'failed', []);
|
|
1630
|
+
const result = [];
|
|
1631
|
+
for (let i = 0; i < cancelled.length; i++) {
|
|
1632
|
+
const orderId = cancelled[i];
|
|
1633
|
+
result.push(this.safeOrder({
|
|
1634
|
+
'info': orderId,
|
|
1635
|
+
'id': orderId,
|
|
1636
|
+
'status': 'canceled',
|
|
1637
|
+
}));
|
|
1638
|
+
}
|
|
1639
|
+
for (let i = 0; i < failed.length; i++) {
|
|
1640
|
+
const orderId = failed[i];
|
|
1641
|
+
result.push(this.safeOrder({
|
|
1642
|
+
'info': orderId,
|
|
1643
|
+
'id': orderId,
|
|
1644
|
+
'status': 'failed',
|
|
1645
|
+
}));
|
|
1646
|
+
}
|
|
1647
|
+
return result;
|
|
1628
1648
|
}
|
|
1629
1649
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
1630
1650
|
/**
|
package/js/src/bingx.js
CHANGED
|
@@ -823,13 +823,14 @@ export default class bingx extends Exchange {
|
|
|
823
823
|
* @see https://bingx-api.github.io/docs/#/spot/market-api.html#Candlestick%20chart%20data
|
|
824
824
|
* @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#%20K-Line%20Data
|
|
825
825
|
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#K-Line%20Data%20-%20Mark%20Price
|
|
826
|
+
* @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20K-line%20Data
|
|
826
827
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
827
828
|
* @param {string} timeframe the length of time each candle represents
|
|
828
829
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
829
830
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
830
831
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
831
832
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
832
|
-
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [
|
|
833
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
833
834
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
834
835
|
*/
|
|
835
836
|
await this.loadMarkets();
|
|
@@ -859,13 +860,18 @@ export default class bingx extends Exchange {
|
|
|
859
860
|
response = await this.spotV1PublicGetMarketKline(this.extend(request, params));
|
|
860
861
|
}
|
|
861
862
|
else {
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
if (price === 'mark') {
|
|
865
|
-
response = await this.swapV1PrivateGetMarketMarkPriceKlines(this.extend(request, params));
|
|
863
|
+
if (market['inverse']) {
|
|
864
|
+
response = await this.cswapV1PublicGetMarketKlines(this.extend(request, params));
|
|
866
865
|
}
|
|
867
866
|
else {
|
|
868
|
-
|
|
867
|
+
const price = this.safeString(params, 'price');
|
|
868
|
+
params = this.omit(params, 'price');
|
|
869
|
+
if (price === 'mark') {
|
|
870
|
+
response = await this.swapV1PrivateGetMarketMarkPriceKlines(this.extend(request, params));
|
|
871
|
+
}
|
|
872
|
+
else {
|
|
873
|
+
response = await this.swapV3PublicGetQuoteKlines(this.extend(request, params));
|
|
874
|
+
}
|
|
869
875
|
}
|
|
870
876
|
}
|
|
871
877
|
//
|
|
@@ -1177,6 +1183,7 @@ export default class bingx extends Exchange {
|
|
|
1177
1183
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
1178
1184
|
* @see https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20depth%20information
|
|
1179
1185
|
* @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Get%20Market%20Depth
|
|
1186
|
+
* @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Query%20Depth%20Data
|
|
1180
1187
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
1181
1188
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
1182
1189
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -1197,7 +1204,12 @@ export default class bingx extends Exchange {
|
|
|
1197
1204
|
response = await this.spotV1PublicGetMarketDepth(this.extend(request, params));
|
|
1198
1205
|
}
|
|
1199
1206
|
else {
|
|
1200
|
-
|
|
1207
|
+
if (market['inverse']) {
|
|
1208
|
+
response = await this.cswapV1PublicGetMarketDepth(this.extend(request, params));
|
|
1209
|
+
}
|
|
1210
|
+
else {
|
|
1211
|
+
response = await this.swapV2PublicGetQuoteDepth(this.extend(request, params));
|
|
1212
|
+
}
|
|
1201
1213
|
}
|
|
1202
1214
|
//
|
|
1203
1215
|
// spot
|
|
@@ -1266,6 +1278,7 @@ export default class bingx extends Exchange {
|
|
|
1266
1278
|
* @name bingx#fetchFundingRate
|
|
1267
1279
|
* @description fetch the current funding rate
|
|
1268
1280
|
* @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Current%20Funding%20Rate
|
|
1281
|
+
* @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Price%20&%20Current%20Funding%20Rate
|
|
1269
1282
|
* @param {string} symbol unified market symbol
|
|
1270
1283
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1271
1284
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
@@ -1275,7 +1288,13 @@ export default class bingx extends Exchange {
|
|
|
1275
1288
|
const request = {
|
|
1276
1289
|
'symbol': market['id'],
|
|
1277
1290
|
};
|
|
1278
|
-
|
|
1291
|
+
let response = undefined;
|
|
1292
|
+
if (market['inverse']) {
|
|
1293
|
+
response = await this.cswapV1PublicGetMarketPremiumIndex(this.extend(request, params));
|
|
1294
|
+
}
|
|
1295
|
+
else {
|
|
1296
|
+
response = await this.swapV2PublicGetQuotePremiumIndex(this.extend(request, params));
|
|
1297
|
+
}
|
|
1279
1298
|
//
|
|
1280
1299
|
// {
|
|
1281
1300
|
// "code":0,
|
|
@@ -1427,9 +1446,10 @@ export default class bingx extends Exchange {
|
|
|
1427
1446
|
/**
|
|
1428
1447
|
* @method
|
|
1429
1448
|
* @name bingx#fetchOpenInterest
|
|
1430
|
-
* @description
|
|
1449
|
+
* @description retrieves the open interest of a trading pair
|
|
1431
1450
|
* @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Get%20Swap%20Open%20Positions
|
|
1432
|
-
* @
|
|
1451
|
+
* @see https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20Swap%20Open%20Positions
|
|
1452
|
+
* @param {string} symbol unified CCXT market symbol
|
|
1433
1453
|
* @param {object} [params] exchange specific parameters
|
|
1434
1454
|
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
1435
1455
|
*/
|
|
@@ -1438,7 +1458,15 @@ export default class bingx extends Exchange {
|
|
|
1438
1458
|
const request = {
|
|
1439
1459
|
'symbol': market['id'],
|
|
1440
1460
|
};
|
|
1441
|
-
|
|
1461
|
+
let response = undefined;
|
|
1462
|
+
if (market['inverse']) {
|
|
1463
|
+
response = await this.cswapV1PublicGetMarketOpenInterest(this.extend(request, params));
|
|
1464
|
+
}
|
|
1465
|
+
else {
|
|
1466
|
+
response = await this.swapV2PublicGetQuoteOpenInterest(this.extend(request, params));
|
|
1467
|
+
}
|
|
1468
|
+
//
|
|
1469
|
+
// linear swap
|
|
1442
1470
|
//
|
|
1443
1471
|
// {
|
|
1444
1472
|
// "code": 0,
|
|
@@ -1450,18 +1478,50 @@ export default class bingx extends Exchange {
|
|
|
1450
1478
|
// }
|
|
1451
1479
|
// }
|
|
1452
1480
|
//
|
|
1453
|
-
|
|
1454
|
-
|
|
1481
|
+
// inverse swap
|
|
1482
|
+
//
|
|
1483
|
+
// {
|
|
1484
|
+
// "code": 0,
|
|
1485
|
+
// "msg": "",
|
|
1486
|
+
// "timestamp": 1720328247986,
|
|
1487
|
+
// "data": [
|
|
1488
|
+
// {
|
|
1489
|
+
// "symbol": "BTC-USD",
|
|
1490
|
+
// "openInterest": "749.1160",
|
|
1491
|
+
// "timestamp": 1720310400000
|
|
1492
|
+
// }
|
|
1493
|
+
// ]
|
|
1494
|
+
// }
|
|
1495
|
+
//
|
|
1496
|
+
let result = {};
|
|
1497
|
+
if (market['inverse']) {
|
|
1498
|
+
const data = this.safeList(response, 'data', []);
|
|
1499
|
+
result = this.safeDict(data, 0, {});
|
|
1500
|
+
}
|
|
1501
|
+
else {
|
|
1502
|
+
result = this.safeDict(response, 'data', {});
|
|
1503
|
+
}
|
|
1504
|
+
return this.parseOpenInterest(result, market);
|
|
1455
1505
|
}
|
|
1456
1506
|
parseOpenInterest(interest, market = undefined) {
|
|
1457
1507
|
//
|
|
1458
|
-
//
|
|
1459
|
-
//
|
|
1460
|
-
//
|
|
1461
|
-
//
|
|
1462
|
-
//
|
|
1508
|
+
// linear swap
|
|
1509
|
+
//
|
|
1510
|
+
// {
|
|
1511
|
+
// "openInterest": "3289641547.10",
|
|
1512
|
+
// "symbol": "BTC-USDT",
|
|
1513
|
+
// "time": 1672026617364
|
|
1514
|
+
// }
|
|
1515
|
+
//
|
|
1516
|
+
// inverse swap
|
|
1517
|
+
//
|
|
1518
|
+
// {
|
|
1519
|
+
// "symbol": "BTC-USD",
|
|
1520
|
+
// "openInterest": "749.1160",
|
|
1521
|
+
// "timestamp": 1720310400000
|
|
1522
|
+
// }
|
|
1463
1523
|
//
|
|
1464
|
-
const timestamp = this.
|
|
1524
|
+
const timestamp = this.safeInteger2(interest, 'time', 'timestamp');
|
|
1465
1525
|
const id = this.safeString(interest, 'symbol');
|
|
1466
1526
|
const symbol = this.safeSymbol(id, market, '-', 'swap');
|
|
1467
1527
|
const openInterest = this.safeNumber(interest, 'openInterest');
|
|
@@ -1959,7 +2019,7 @@ export default class bingx extends Exchange {
|
|
|
1959
2019
|
request['timeInForce'] = 'GTC';
|
|
1960
2020
|
}
|
|
1961
2021
|
if (isSpot) {
|
|
1962
|
-
const cost = this.
|
|
2022
|
+
const cost = this.safeString2(params, 'cost', 'quoteOrderQty');
|
|
1963
2023
|
params = this.omit(params, 'cost');
|
|
1964
2024
|
if (cost !== undefined) {
|
|
1965
2025
|
request['quoteOrderQty'] = this.parseToNumeric(this.costToPrecision(symbol, cost));
|
|
@@ -2104,7 +2164,7 @@ export default class bingx extends Exchange {
|
|
|
2104
2164
|
positionSide = (side === 'buy') ? 'LONG' : 'SHORT';
|
|
2105
2165
|
}
|
|
2106
2166
|
request['positionSide'] = positionSide;
|
|
2107
|
-
request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
|
|
2167
|
+
request['quantity'] = (market['inverse']) ? amount : this.parseToNumeric(this.amountToPrecision(symbol, amount)); // precision not available for inverse contracts
|
|
2108
2168
|
}
|
|
2109
2169
|
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId']);
|
|
2110
2170
|
return this.extend(request, params);
|
|
@@ -2116,6 +2176,7 @@ export default class bingx extends Exchange {
|
|
|
2116
2176
|
* @description create a trade order
|
|
2117
2177
|
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Trade%20order
|
|
2118
2178
|
* @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Create%20an%20Order
|
|
2179
|
+
* @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Trade%20order
|
|
2119
2180
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2120
2181
|
* @param {string} type 'market' or 'limit'
|
|
2121
2182
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -2149,6 +2210,9 @@ export default class bingx extends Exchange {
|
|
|
2149
2210
|
if (test) {
|
|
2150
2211
|
response = await this.swapV2PrivatePostTradeOrderTest(request);
|
|
2151
2212
|
}
|
|
2213
|
+
else if (market['inverse']) {
|
|
2214
|
+
response = await this.cswapV1PrivatePostTradeOrder(request);
|
|
2215
|
+
}
|
|
2152
2216
|
else {
|
|
2153
2217
|
response = await this.swapV2PrivatePostTradeOrder(request);
|
|
2154
2218
|
}
|
|
@@ -2176,7 +2240,7 @@ export default class bingx extends Exchange {
|
|
|
2176
2240
|
// }
|
|
2177
2241
|
// }
|
|
2178
2242
|
//
|
|
2179
|
-
// swap
|
|
2243
|
+
// linear swap
|
|
2180
2244
|
//
|
|
2181
2245
|
// {
|
|
2182
2246
|
// "code": 0,
|
|
@@ -2194,6 +2258,21 @@ export default class bingx extends Exchange {
|
|
|
2194
2258
|
// }
|
|
2195
2259
|
// }
|
|
2196
2260
|
//
|
|
2261
|
+
// inverse swap
|
|
2262
|
+
//
|
|
2263
|
+
// {
|
|
2264
|
+
// "orderId": 1809841379603398656,
|
|
2265
|
+
// "symbol": "SOL-USD",
|
|
2266
|
+
// "positionSide": "LONG",
|
|
2267
|
+
// "side": "BUY",
|
|
2268
|
+
// "type": "LIMIT",
|
|
2269
|
+
// "price": 100,
|
|
2270
|
+
// "quantity": 1,
|
|
2271
|
+
// "stopPrice": 0,
|
|
2272
|
+
// "workingType": "",
|
|
2273
|
+
// "timeInForce": ""
|
|
2274
|
+
// }
|
|
2275
|
+
//
|
|
2197
2276
|
if (typeof response === 'string') {
|
|
2198
2277
|
// broken api engine : order-ids are too long numbers (i.e. 1742930526912864656)
|
|
2199
2278
|
// and JSON.parse can not handle them in JS, so we have to use .parseJson
|
|
@@ -2201,9 +2280,20 @@ export default class bingx extends Exchange {
|
|
|
2201
2280
|
response = this.fixStringifiedJsonMembers(response);
|
|
2202
2281
|
response = this.parseJson(response);
|
|
2203
2282
|
}
|
|
2204
|
-
const data = this.
|
|
2205
|
-
|
|
2206
|
-
|
|
2283
|
+
const data = this.safeDict(response, 'data', {});
|
|
2284
|
+
let result = {};
|
|
2285
|
+
if (market['swap']) {
|
|
2286
|
+
if (market['inverse']) {
|
|
2287
|
+
result = response;
|
|
2288
|
+
}
|
|
2289
|
+
else {
|
|
2290
|
+
result = this.safeDict(data, 'order', {});
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
else {
|
|
2294
|
+
result = data;
|
|
2295
|
+
}
|
|
2296
|
+
return this.parseOrder(result, market);
|
|
2207
2297
|
}
|
|
2208
2298
|
async createOrders(orders, params = {}) {
|
|
2209
2299
|
/**
|
|
@@ -2377,7 +2467,7 @@ export default class bingx extends Exchange {
|
|
|
2377
2467
|
// }
|
|
2378
2468
|
//
|
|
2379
2469
|
//
|
|
2380
|
-
// swap
|
|
2470
|
+
// linear swap
|
|
2381
2471
|
// createOrder, createOrders
|
|
2382
2472
|
//
|
|
2383
2473
|
// {
|
|
@@ -2388,6 +2478,21 @@ export default class bingx extends Exchange {
|
|
|
2388
2478
|
// "type": "LIMIT"
|
|
2389
2479
|
// }
|
|
2390
2480
|
//
|
|
2481
|
+
// inverse swap createOrder
|
|
2482
|
+
//
|
|
2483
|
+
// {
|
|
2484
|
+
// "orderId": 1809841379603398656,
|
|
2485
|
+
// "symbol": "SOL-USD",
|
|
2486
|
+
// "positionSide": "LONG",
|
|
2487
|
+
// "side": "BUY",
|
|
2488
|
+
// "type": "LIMIT",
|
|
2489
|
+
// "price": 100,
|
|
2490
|
+
// "quantity": 1,
|
|
2491
|
+
// "stopPrice": 0,
|
|
2492
|
+
// "workingType": "",
|
|
2493
|
+
// "timeInForce": ""
|
|
2494
|
+
// }
|
|
2495
|
+
//
|
|
2391
2496
|
// fetchOrder, fetchOpenOrders, fetchClosedOrders
|
|
2392
2497
|
//
|
|
2393
2498
|
// {
|
package/js/src/bitmart.js
CHANGED
|
@@ -203,6 +203,7 @@ export default class bitmart extends Exchange {
|
|
|
203
203
|
'contract/private/get-open-orders': 1.2,
|
|
204
204
|
'contract/private/current-plan-order': 1.2,
|
|
205
205
|
'contract/private/trades': 10,
|
|
206
|
+
'contract/private/position-risk': 10,
|
|
206
207
|
},
|
|
207
208
|
'post': {
|
|
208
209
|
// sub-account endpoints
|
package/js/src/btcbox.d.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import Exchange from './abstract/btcbox.js';
|
|
2
|
-
import type { Balances, Dict, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, int } from './base/types.js';
|
|
2
|
+
import type { Balances, Dict, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, int } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class btcbox
|
|
5
5
|
* @augments Exchange
|
|
6
6
|
*/
|
|
7
7
|
export default class btcbox extends Exchange {
|
|
8
8
|
describe(): any;
|
|
9
|
+
fetchMarkets(params?: {}): Promise<Market[]>;
|
|
10
|
+
parseMarket(market: Dict): Market;
|
|
9
11
|
parseBalance(response: any): Balances;
|
|
10
12
|
fetchBalance(params?: {}): Promise<Balances>;
|
|
11
13
|
fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
12
14
|
parseTicker(ticker: Dict, market?: Market): Ticker;
|
|
13
15
|
fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
16
|
+
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
14
17
|
parseTrade(trade: Dict, market?: Market): Trade;
|
|
15
18
|
fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
16
19
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|