ccxt 4.2.20 → 4.2.21
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 +1054 -233
- package/dist/ccxt.browser.min.js +6 -6
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +37 -4
- package/dist/cjs/src/base/ws/WsClient.js +3 -1
- package/dist/cjs/src/bitget.js +1 -1
- package/dist/cjs/src/bitvavo.js +271 -172
- package/dist/cjs/src/blockchaincom.js +3 -1
- package/dist/cjs/src/gate.js +32 -1
- package/dist/cjs/src/novadax.js +26 -22
- package/dist/cjs/src/phemex.js +2 -1
- package/dist/cjs/src/pro/bitopro.js +7 -3
- package/dist/cjs/src/pro/bitvavo.js +668 -22
- package/dist/cjs/src/pro/lbank.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/gate.d.ts +1 -0
- package/js/src/abstract/gateio.d.ts +1 -0
- package/js/src/abstract/novadax.d.ts +5 -1
- package/js/src/abstract/phemex.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +12 -1
- package/js/src/base/Exchange.js +37 -4
- package/js/src/base/ws/WsClient.js +3 -2
- package/js/src/bitget.js +1 -1
- package/js/src/bitvavo.d.ts +14 -2
- package/js/src/bitvavo.js +271 -172
- package/js/src/blockchaincom.js +3 -1
- package/js/src/gate.d.ts +1 -0
- package/js/src/gate.js +32 -1
- package/js/src/novadax.js +26 -22
- package/js/src/phemex.js +2 -1
- package/js/src/pro/bitopro.js +7 -3
- package/js/src/pro/bitvavo.d.ts +35 -2
- package/js/src/pro/bitvavo.js +669 -23
- package/js/src/pro/lbank.js +1 -1
- package/package.json +1 -1
package/js/src/gate.js
CHANGED
|
@@ -532,6 +532,7 @@ export default class gate extends Exchange {
|
|
|
532
532
|
'multi_collateral/currency_quota': 20 / 15,
|
|
533
533
|
'multi_collateral/currencies': 20 / 15,
|
|
534
534
|
'multi_collateral/ltv': 20 / 15,
|
|
535
|
+
'multi_collateral/fixed_rate': 20 / 15,
|
|
535
536
|
},
|
|
536
537
|
'post': {
|
|
537
538
|
'collateral/orders': 20 / 15,
|
|
@@ -5561,7 +5562,7 @@ export default class gate extends Exchange {
|
|
|
5561
5562
|
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
|
5562
5563
|
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
|
|
5563
5564
|
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts-2
|
|
5564
|
-
* @param {string[]
|
|
5565
|
+
* @param {string[]} [symbols] list of unified market symbols
|
|
5565
5566
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5566
5567
|
* @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
|
|
5567
5568
|
*/
|
|
@@ -5706,6 +5707,33 @@ export default class gate extends Exchange {
|
|
|
5706
5707
|
//
|
|
5707
5708
|
return this.parseMarketLeverageTiers(response, market);
|
|
5708
5709
|
}
|
|
5710
|
+
parseEmulatedLeverageTiers(info, market = undefined) {
|
|
5711
|
+
const maintenanceMarginUnit = this.safeString(info, 'maintenance_rate'); // '0.005',
|
|
5712
|
+
const leverageMax = this.safeString(info, 'leverage_max'); // '100',
|
|
5713
|
+
const riskLimitStep = this.safeString(info, 'risk_limit_step'); // '1000000',
|
|
5714
|
+
const riskLimitMax = this.safeString(info, 'risk_limit_max'); // '16000000',
|
|
5715
|
+
const initialMarginUnit = Precise.stringDiv('1', leverageMax);
|
|
5716
|
+
let maintenanceMarginRate = maintenanceMarginUnit;
|
|
5717
|
+
let initialMarginRatio = initialMarginUnit;
|
|
5718
|
+
let floor = '0';
|
|
5719
|
+
const tiers = [];
|
|
5720
|
+
while (Precise.stringLt(floor, riskLimitMax)) {
|
|
5721
|
+
const cap = Precise.stringAdd(floor, riskLimitStep);
|
|
5722
|
+
tiers.push({
|
|
5723
|
+
'tier': this.parseNumber(Precise.stringDiv(cap, riskLimitStep)),
|
|
5724
|
+
'currency': this.safeString(market, 'settle'),
|
|
5725
|
+
'minNotional': this.parseNumber(floor),
|
|
5726
|
+
'maxNotional': this.parseNumber(cap),
|
|
5727
|
+
'maintenanceMarginRate': this.parseNumber(maintenanceMarginRate),
|
|
5728
|
+
'maxLeverage': this.parseNumber(Precise.stringDiv('1', initialMarginRatio)),
|
|
5729
|
+
'info': info,
|
|
5730
|
+
});
|
|
5731
|
+
maintenanceMarginRate = Precise.stringAdd(maintenanceMarginRate, maintenanceMarginUnit);
|
|
5732
|
+
initialMarginRatio = Precise.stringAdd(initialMarginRatio, initialMarginUnit);
|
|
5733
|
+
floor = cap;
|
|
5734
|
+
}
|
|
5735
|
+
return tiers;
|
|
5736
|
+
}
|
|
5709
5737
|
parseMarketLeverageTiers(info, market = undefined) {
|
|
5710
5738
|
//
|
|
5711
5739
|
// [
|
|
@@ -5718,6 +5746,9 @@ export default class gate extends Exchange {
|
|
|
5718
5746
|
// }
|
|
5719
5747
|
// ]
|
|
5720
5748
|
//
|
|
5749
|
+
if (!Array.isArray(info)) {
|
|
5750
|
+
return this.parseEmulatedLeverageTiers(info, market);
|
|
5751
|
+
}
|
|
5721
5752
|
let minNotional = 0;
|
|
5722
5753
|
const tiers = [];
|
|
5723
5754
|
for (let i = 0; i < info.length; i++) {
|
package/js/src/novadax.js
CHANGED
|
@@ -22,9 +22,9 @@ export default class novadax extends Exchange {
|
|
|
22
22
|
'id': 'novadax',
|
|
23
23
|
'name': 'NovaDAX',
|
|
24
24
|
'countries': ['BR'],
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
'rateLimit':
|
|
25
|
+
// 6000 weight per min => 100 weight per second => min weight = 1
|
|
26
|
+
// 100 requests per second => ( 1000ms / 100 ) = 10 ms between requests on average
|
|
27
|
+
'rateLimit': 10,
|
|
28
28
|
'version': 'v1',
|
|
29
29
|
// new metainfo interface
|
|
30
30
|
'has': {
|
|
@@ -122,33 +122,37 @@ export default class novadax extends Exchange {
|
|
|
122
122
|
'api': {
|
|
123
123
|
'public': {
|
|
124
124
|
'get': {
|
|
125
|
-
'common/symbol': 1
|
|
126
|
-
'common/symbols': 1
|
|
127
|
-
'common/timestamp': 1
|
|
128
|
-
'market/tickers':
|
|
129
|
-
'market/ticker': 1
|
|
130
|
-
'market/depth': 1
|
|
131
|
-
'market/trades':
|
|
132
|
-
'market/kline/history':
|
|
125
|
+
'common/symbol': 1,
|
|
126
|
+
'common/symbols': 1,
|
|
127
|
+
'common/timestamp': 1,
|
|
128
|
+
'market/tickers': 5,
|
|
129
|
+
'market/ticker': 1,
|
|
130
|
+
'market/depth': 1,
|
|
131
|
+
'market/trades': 5,
|
|
132
|
+
'market/kline/history': 5,
|
|
133
133
|
},
|
|
134
134
|
},
|
|
135
135
|
'private': {
|
|
136
136
|
'get': {
|
|
137
|
-
'orders/get':
|
|
138
|
-
'orders/list':
|
|
137
|
+
'orders/get': 1,
|
|
138
|
+
'orders/list': 10,
|
|
139
139
|
'orders/fill': 3,
|
|
140
|
-
'orders/fills':
|
|
141
|
-
'account/getBalance':
|
|
142
|
-
'account/subs':
|
|
143
|
-
'account/subs/balance':
|
|
144
|
-
'account/subs/transfer/record':
|
|
140
|
+
'orders/fills': 10,
|
|
141
|
+
'account/getBalance': 1,
|
|
142
|
+
'account/subs': 1,
|
|
143
|
+
'account/subs/balance': 1,
|
|
144
|
+
'account/subs/transfer/record': 10,
|
|
145
145
|
'wallet/query/deposit-withdraw': 3,
|
|
146
146
|
},
|
|
147
147
|
'post': {
|
|
148
|
-
'orders/create':
|
|
149
|
-
'orders/
|
|
150
|
-
'
|
|
151
|
-
'
|
|
148
|
+
'orders/create': 5,
|
|
149
|
+
'orders/batch-create': 50,
|
|
150
|
+
'orders/cancel': 1,
|
|
151
|
+
'orders/batch-cancel': 10,
|
|
152
|
+
'orders/cancel-by-symbol': 10,
|
|
153
|
+
'account/subs/transfer': 5,
|
|
154
|
+
'wallet/withdraw/coin': 3,
|
|
155
|
+
'account/withdraw/coin': 3, // not found in doc
|
|
152
156
|
},
|
|
153
157
|
},
|
|
154
158
|
},
|
package/js/src/phemex.js
CHANGED
|
@@ -193,6 +193,7 @@ export default class phemex extends Exchange {
|
|
|
193
193
|
'api-data/g-futures/trades': 5,
|
|
194
194
|
'api-data/futures/trading-fees': 5,
|
|
195
195
|
'api-data/g-futures/trading-fees': 5,
|
|
196
|
+
'api-data/futures/v2/tradeAccountDetail': 5,
|
|
196
197
|
'g-orders/activeList': 1,
|
|
197
198
|
'orders/activeList': 1,
|
|
198
199
|
'exchange/order/list': 5,
|
|
@@ -2770,7 +2771,7 @@ export default class phemex extends Exchange {
|
|
|
2770
2771
|
}
|
|
2771
2772
|
else if (amount !== undefined) {
|
|
2772
2773
|
if (isUSDTSettled) {
|
|
2773
|
-
request['
|
|
2774
|
+
request['orderQtyRq'] = this.amountToPrecision(market['symbol'], amount);
|
|
2774
2775
|
}
|
|
2775
2776
|
else {
|
|
2776
2777
|
request['baseQtyEV'] = this.toEv(amount, market);
|
package/js/src/pro/bitopro.js
CHANGED
|
@@ -26,8 +26,8 @@ export default class bitopro extends bitoproRest {
|
|
|
26
26
|
},
|
|
27
27
|
'urls': {
|
|
28
28
|
'ws': {
|
|
29
|
-
'public': 'wss://stream.bitopro.com:
|
|
30
|
-
'private': 'wss://stream.bitopro.com:
|
|
29
|
+
'public': 'wss://stream.bitopro.com:443/ws/v1/pub',
|
|
30
|
+
'private': 'wss://stream.bitopro.com:443/ws/v1/pub/auth',
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
33
|
'requiredCredentials': {
|
|
@@ -56,6 +56,7 @@ export default class bitopro extends bitoproRest {
|
|
|
56
56
|
* @method
|
|
57
57
|
* @name bitopro#watchOrderBook
|
|
58
58
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
59
|
+
* @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/public/order_book_stream.md
|
|
59
60
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
60
61
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
61
62
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -121,6 +122,7 @@ export default class bitopro extends bitoproRest {
|
|
|
121
122
|
* @method
|
|
122
123
|
* @name bitopro#watchTrades
|
|
123
124
|
* @description get the list of most recent trades for a particular symbol
|
|
125
|
+
* @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/public/trade_stream.md
|
|
124
126
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
125
127
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
126
128
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -180,6 +182,7 @@ export default class bitopro extends bitoproRest {
|
|
|
180
182
|
* @method
|
|
181
183
|
* @name bitopro#watchTicker
|
|
182
184
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
185
|
+
* @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/public/ticker_stream.md
|
|
183
186
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
184
187
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
185
188
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -233,7 +236,7 @@ export default class bitopro extends bitoproRest {
|
|
|
233
236
|
'identity': this.login,
|
|
234
237
|
});
|
|
235
238
|
const payload = this.stringToBase64(rawData);
|
|
236
|
-
const signature = this.hmac(payload, this.encode(this.secret), sha384);
|
|
239
|
+
const signature = this.hmac(this.encode(payload), this.encode(this.secret), sha384);
|
|
237
240
|
const defaultOptions = {
|
|
238
241
|
'ws': {
|
|
239
242
|
'options': {
|
|
@@ -259,6 +262,7 @@ export default class bitopro extends bitoproRest {
|
|
|
259
262
|
* @method
|
|
260
263
|
* @name bitopro#watchBalance
|
|
261
264
|
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
265
|
+
* @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/private/user_balance_stream.md
|
|
262
266
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
263
267
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
264
268
|
*/
|
package/js/src/pro/bitvavo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import bitvavoRest from '../bitvavo.js';
|
|
2
|
-
import
|
|
2
|
+
import { Int, Str, OrderSide, OrderType, OrderBook, Ticker, Trade, Order, OHLCV, Balances } from '../base/types.js';
|
|
3
3
|
import Client from '../base/ws/Client.js';
|
|
4
4
|
export default class bitvavo extends bitvavoRest {
|
|
5
5
|
describe(): any;
|
|
@@ -9,6 +9,7 @@ export default class bitvavo extends bitvavoRest {
|
|
|
9
9
|
watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
10
10
|
handleTrade(client: Client, message: any): void;
|
|
11
11
|
watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
12
|
+
handleFetchOHLCV(client: Client, message: any): void;
|
|
12
13
|
handleOHLCV(client: Client, message: any): void;
|
|
13
14
|
watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
14
15
|
handleDelta(bookside: any, delta: any): void;
|
|
@@ -21,10 +22,42 @@ export default class bitvavo extends bitvavoRest {
|
|
|
21
22
|
handleOrderBookSubscriptions(client: Client, message: any, marketIds: any): void;
|
|
22
23
|
watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
23
24
|
watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
25
|
+
createOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
|
|
26
|
+
editOrderWs(id: string, symbol: any, type: any, side: any, amount?: any, price?: any, params?: {}): Promise<Order>;
|
|
27
|
+
cancelOrderWs(id: string, symbol?: string, params?: {}): Promise<any>;
|
|
28
|
+
cancelAllOrdersWs(symbol?: string, params?: {}): Promise<any>;
|
|
29
|
+
handleMultipleOrders(client: Client, message: any): void;
|
|
30
|
+
fetchOrderWs(id: string, symbol?: string, params?: {}): Promise<Order>;
|
|
31
|
+
fetchOrdersWs(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
32
|
+
watchRequest(action: any, request: any): Promise<any>;
|
|
33
|
+
fetchOpenOrdersWs(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
34
|
+
fetchMyTradesWs(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
35
|
+
handleMyTrades(client: Client, message: any): void;
|
|
36
|
+
withdrawWs(code: string, amount: any, address: any, tag?: any, params?: {}): Promise<any>;
|
|
37
|
+
handleWithdraw(client: Client, message: any): void;
|
|
38
|
+
fetchWithdrawalsWs(code?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
39
|
+
handleWithdraws(client: Client, message: any): void;
|
|
40
|
+
fetchOHLCVWs(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
41
|
+
fetchDepositsWs(code?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
42
|
+
handleDeposits(client: Client, message: any): void;
|
|
43
|
+
fetchTradingFeesWs(params?: {}): Promise<any>;
|
|
44
|
+
fetchMarketsWs(params?: {}): Promise<any>;
|
|
45
|
+
fetchCurrenciesWs(params?: {}): Promise<any>;
|
|
46
|
+
handleFetchCurrencies(client: Client, message: any): void;
|
|
47
|
+
handleTradingFees(client: any, message: any): void;
|
|
48
|
+
fetchBalanceWs(params?: {}): Promise<Balances>;
|
|
49
|
+
handleFetchBalance(client: Client, message: any): void;
|
|
50
|
+
handleSingleOrder(client: Client, message: any): void;
|
|
51
|
+
handleMarkets(client: Client, message: any): void;
|
|
52
|
+
buildMessageHash(action: any, params?: {}): any;
|
|
53
|
+
checkMessageHashDoesNotExist(messageHash: any): void;
|
|
54
|
+
actionAndMarketMessageHash(action: any, params?: {}): string;
|
|
55
|
+
actionAndOrderIdMessageHash(action: any, params?: {}): string;
|
|
24
56
|
handleOrder(client: Client, message: any): void;
|
|
25
57
|
handleMyTrade(client: Client, message: any): void;
|
|
26
58
|
handleSubscriptionStatus(client: Client, message: any): any;
|
|
27
59
|
authenticate(params?: {}): any;
|
|
28
60
|
handleAuthenticationMessage(client: Client, message: any): void;
|
|
29
|
-
|
|
61
|
+
handleErrorMessage(client: Client, message: any): void;
|
|
62
|
+
handleMessage(client: Client, message: any): void;
|
|
30
63
|
}
|