ccxt 4.3.31 → 4.3.32
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.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +14 -0
- package/dist/cjs/src/coinex.js +42 -39
- package/dist/cjs/src/pro/cex.js +1 -1
- package/dist/cjs/src/pro/coinbase.js +31 -0
- package/dist/cjs/src/pro/mexc.js +7 -7
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +4 -2
- package/js/src/base/Exchange.js +14 -0
- package/js/src/coinex.d.ts +2 -2
- package/js/src/coinex.js +42 -39
- package/js/src/pro/cex.js +1 -1
- package/js/src/pro/coinbase.js +31 -0
- package/js/src/pro/mexc.js +7 -7
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -185,7 +185,7 @@ var woofipro$1 = require('./src/pro/woofipro.js');
|
|
|
185
185
|
|
|
186
186
|
//-----------------------------------------------------------------------------
|
|
187
187
|
// this is updated by vss.js when building
|
|
188
|
-
const version = '4.3.
|
|
188
|
+
const version = '4.3.32';
|
|
189
189
|
Exchange["default"].ccxtVersion = version;
|
|
190
190
|
const exchanges = {
|
|
191
191
|
'ace': ace,
|
|
@@ -3696,6 +3696,20 @@ class Exchange {
|
|
|
3696
3696
|
}
|
|
3697
3697
|
return [value, params];
|
|
3698
3698
|
}
|
|
3699
|
+
handleParamBool(params, paramName, defaultValue = undefined) {
|
|
3700
|
+
const value = this.safeBool(params, paramName, defaultValue);
|
|
3701
|
+
if (value !== undefined) {
|
|
3702
|
+
params = this.omit(params, paramName);
|
|
3703
|
+
}
|
|
3704
|
+
return [value, params];
|
|
3705
|
+
}
|
|
3706
|
+
handleParamBool2(params, paramName1, paramName2, defaultValue = undefined) {
|
|
3707
|
+
const value = this.safeBool2(params, paramName1, paramName2, defaultValue);
|
|
3708
|
+
if (value !== undefined) {
|
|
3709
|
+
params = this.omit(params, [paramName1, paramName2]);
|
|
3710
|
+
}
|
|
3711
|
+
return [value, params];
|
|
3712
|
+
}
|
|
3699
3713
|
resolvePath(path, params) {
|
|
3700
3714
|
return [
|
|
3701
3715
|
this.implodeParams(path, params),
|
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -77,8 +77,8 @@ class coinex extends coinex$1 {
|
|
|
77
77
|
'fetchIndexOHLCV': false,
|
|
78
78
|
'fetchIsolatedBorrowRate': true,
|
|
79
79
|
'fetchIsolatedBorrowRates': false,
|
|
80
|
-
'fetchLeverage':
|
|
81
|
-
'fetchLeverages':
|
|
80
|
+
'fetchLeverage': true,
|
|
81
|
+
'fetchLeverages': false,
|
|
82
82
|
'fetchLeverageTiers': true,
|
|
83
83
|
'fetchMarginAdjustmentHistory': true,
|
|
84
84
|
'fetchMarketLeverageTiers': 'emulated',
|
|
@@ -5523,61 +5523,64 @@ class coinex extends coinex$1 {
|
|
|
5523
5523
|
}
|
|
5524
5524
|
return result;
|
|
5525
5525
|
}
|
|
5526
|
-
async
|
|
5526
|
+
async fetchLeverage(symbol, params = {}) {
|
|
5527
5527
|
/**
|
|
5528
5528
|
* @method
|
|
5529
|
-
* @name coinex#
|
|
5530
|
-
* @description fetch the set leverage for
|
|
5531
|
-
* @see https://
|
|
5532
|
-
* @param {string
|
|
5529
|
+
* @name coinex#fetchLeverage
|
|
5530
|
+
* @description fetch the set leverage for a market
|
|
5531
|
+
* @see https://docs.coinex.com/api/v2/assets/loan-flat/http/list-margin-interest-limit
|
|
5532
|
+
* @param {string} symbol unified market symbol
|
|
5533
5533
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5534
|
-
* @
|
|
5534
|
+
* @param {string} params.code unified currency code
|
|
5535
|
+
* @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
5535
5536
|
*/
|
|
5536
5537
|
await this.loadMarkets();
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
const symbol = this.safeValue(symbols, 0);
|
|
5541
|
-
market = this.market(symbol);
|
|
5542
|
-
}
|
|
5543
|
-
let marketType = undefined;
|
|
5544
|
-
[marketType, params] = this.handleMarketTypeAndParams('fetchLeverages', market, params);
|
|
5545
|
-
if (marketType !== 'spot') {
|
|
5546
|
-
throw new errors.NotSupported(this.id + ' fetchLeverages() supports spot margin markets only');
|
|
5538
|
+
const code = this.safeString(params, 'code');
|
|
5539
|
+
if (code === undefined) {
|
|
5540
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchLeverage() requires a code parameter');
|
|
5547
5541
|
}
|
|
5548
|
-
|
|
5542
|
+
params = this.omit(params, 'code');
|
|
5543
|
+
const currency = this.currency(code);
|
|
5544
|
+
const market = this.market(symbol);
|
|
5545
|
+
const request = {
|
|
5546
|
+
'market': market['id'],
|
|
5547
|
+
'ccy': currency['id'],
|
|
5548
|
+
};
|
|
5549
|
+
const response = await this.v2PrivateGetAssetsMarginInterestLimit(this.extend(request, params));
|
|
5549
5550
|
//
|
|
5550
5551
|
// {
|
|
5551
5552
|
// "code": 0,
|
|
5552
|
-
// "data":
|
|
5553
|
-
//
|
|
5554
|
-
//
|
|
5555
|
-
//
|
|
5556
|
-
//
|
|
5557
|
-
//
|
|
5558
|
-
//
|
|
5559
|
-
//
|
|
5560
|
-
//
|
|
5561
|
-
// "USDT": {
|
|
5562
|
-
// "min_amount": "50",
|
|
5563
|
-
// "max_amount": "500000",
|
|
5564
|
-
// "day_rate": "0.001"
|
|
5565
|
-
// }
|
|
5566
|
-
// },
|
|
5567
|
-
// ],
|
|
5568
|
-
// "message": "Success"
|
|
5553
|
+
// "data": {
|
|
5554
|
+
// "market": "BTCUSDT",
|
|
5555
|
+
// "ccy": "USDT",
|
|
5556
|
+
// "leverage": 10,
|
|
5557
|
+
// "min_amount": "50",
|
|
5558
|
+
// "max_amount": "500000",
|
|
5559
|
+
// "daily_interest_rate": "0.001"
|
|
5560
|
+
// },
|
|
5561
|
+
// "message": "OK"
|
|
5569
5562
|
// }
|
|
5570
5563
|
//
|
|
5571
|
-
const
|
|
5572
|
-
return this.
|
|
5564
|
+
const data = this.safeDict(response, 'data', {});
|
|
5565
|
+
return this.parseLeverage(data, market);
|
|
5573
5566
|
}
|
|
5574
5567
|
parseLeverage(leverage, market = undefined) {
|
|
5568
|
+
//
|
|
5569
|
+
// {
|
|
5570
|
+
// "market": "BTCUSDT",
|
|
5571
|
+
// "ccy": "USDT",
|
|
5572
|
+
// "leverage": 10,
|
|
5573
|
+
// "min_amount": "50",
|
|
5574
|
+
// "max_amount": "500000",
|
|
5575
|
+
// "daily_interest_rate": "0.001"
|
|
5576
|
+
// }
|
|
5577
|
+
//
|
|
5575
5578
|
const marketId = this.safeString(leverage, 'market');
|
|
5576
5579
|
const leverageValue = this.safeInteger(leverage, 'leverage');
|
|
5577
5580
|
return {
|
|
5578
5581
|
'info': leverage,
|
|
5579
5582
|
'symbol': this.safeSymbol(marketId, market, undefined, 'spot'),
|
|
5580
|
-
'marginMode':
|
|
5583
|
+
'marginMode': 'isolated',
|
|
5581
5584
|
'longLeverage': leverageValue,
|
|
5582
5585
|
'shortLeverage': leverageValue,
|
|
5583
5586
|
};
|
package/dist/cjs/src/pro/cex.js
CHANGED
|
@@ -976,7 +976,7 @@ class cex extends cex$1 {
|
|
|
976
976
|
const symbol = this.pairToSymbol(pair);
|
|
977
977
|
const messageHash = 'orderbook:' + symbol;
|
|
978
978
|
const timestamp = this.safeInteger2(data, 'timestamp_ms', 'timestamp');
|
|
979
|
-
const incrementalId = this.
|
|
979
|
+
const incrementalId = this.safeInteger(data, 'id');
|
|
980
980
|
const orderbook = this.orderBook({});
|
|
981
981
|
const snapshot = this.parseOrderBook(data, symbol, timestamp, 'bids', 'asks');
|
|
982
982
|
snapshot['nonce'] = incrementalId;
|
|
@@ -244,6 +244,34 @@ class coinbase extends coinbase$1 {
|
|
|
244
244
|
// ]
|
|
245
245
|
// }
|
|
246
246
|
//
|
|
247
|
+
// note! seems coinbase might also send empty data like:
|
|
248
|
+
//
|
|
249
|
+
// {
|
|
250
|
+
// "channel": "ticker_batch",
|
|
251
|
+
// "client_id": "",
|
|
252
|
+
// "timestamp": "2024-05-24T18:22:24.546809523Z",
|
|
253
|
+
// "sequence_num": 1,
|
|
254
|
+
// "events": [
|
|
255
|
+
// {
|
|
256
|
+
// "type": "snapshot",
|
|
257
|
+
// "tickers": [
|
|
258
|
+
// {
|
|
259
|
+
// "type": "ticker",
|
|
260
|
+
// "product_id": "",
|
|
261
|
+
// "price": "",
|
|
262
|
+
// "volume_24_h": "",
|
|
263
|
+
// "low_24_h": "",
|
|
264
|
+
// "high_24_h": "",
|
|
265
|
+
// "low_52_w": "",
|
|
266
|
+
// "high_52_w": "",
|
|
267
|
+
// "price_percent_chg_24_h": ""
|
|
268
|
+
// }
|
|
269
|
+
// ]
|
|
270
|
+
// }
|
|
271
|
+
// ]
|
|
272
|
+
// }
|
|
273
|
+
//
|
|
274
|
+
//
|
|
247
275
|
const channel = this.safeString(message, 'channel');
|
|
248
276
|
const events = this.safeValue(message, 'events', []);
|
|
249
277
|
const datetime = this.safeString(message, 'timestamp');
|
|
@@ -260,6 +288,9 @@ class coinbase extends coinbase$1 {
|
|
|
260
288
|
const symbol = result['symbol'];
|
|
261
289
|
this.tickers[symbol] = result;
|
|
262
290
|
const wsMarketId = this.safeString(ticker, 'product_id');
|
|
291
|
+
if (wsMarketId === undefined) {
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
263
294
|
const messageHash = channel + '::' + wsMarketId;
|
|
264
295
|
newTickers.push(result);
|
|
265
296
|
client.resolve(result, messageHash);
|
package/dist/cjs/src/pro/mexc.js
CHANGED
|
@@ -69,7 +69,7 @@ class mexc extends mexc$1 {
|
|
|
69
69
|
async watchTicker(symbol, params = {}) {
|
|
70
70
|
/**
|
|
71
71
|
* @method
|
|
72
|
-
* @name
|
|
72
|
+
* @name mexc#watchTicker
|
|
73
73
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
74
74
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
75
75
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -202,7 +202,7 @@ class mexc extends mexc$1 {
|
|
|
202
202
|
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
203
203
|
/**
|
|
204
204
|
* @method
|
|
205
|
-
* @name
|
|
205
|
+
* @name mexc#watchOHLCV
|
|
206
206
|
* @see https://mxcdevelop.github.io/apidocs/spot_v3_en/#kline-streams
|
|
207
207
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
208
208
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
@@ -348,7 +348,7 @@ class mexc extends mexc$1 {
|
|
|
348
348
|
async watchOrderBook(symbol, limit = undefined, params = {}) {
|
|
349
349
|
/**
|
|
350
350
|
* @method
|
|
351
|
-
* @name
|
|
351
|
+
* @name mexc#watchOrderBook
|
|
352
352
|
* @see https://mxcdevelop.github.io/apidocs/spot_v3_en/#diff-depth-stream
|
|
353
353
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
354
354
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
@@ -518,7 +518,7 @@ class mexc extends mexc$1 {
|
|
|
518
518
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
519
519
|
/**
|
|
520
520
|
* @method
|
|
521
|
-
* @name
|
|
521
|
+
* @name mexc#watchTrades
|
|
522
522
|
* @see https://mxcdevelop.github.io/apidocs/spot_v3_en/#trade-streams
|
|
523
523
|
* @description get the list of most recent trades for a particular symbol
|
|
524
524
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
@@ -607,7 +607,7 @@ class mexc extends mexc$1 {
|
|
|
607
607
|
async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
608
608
|
/**
|
|
609
609
|
* @method
|
|
610
|
-
* @name
|
|
610
|
+
* @name mexc#watchMyTrades
|
|
611
611
|
* @see https://mxcdevelop.github.io/apidocs/spot_v3_en/#spot-account-deals
|
|
612
612
|
* @description watches information on multiple trades made by the user
|
|
613
613
|
* @param {string} symbol unified market symbol of the market trades were made in
|
|
@@ -754,7 +754,7 @@ class mexc extends mexc$1 {
|
|
|
754
754
|
async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
755
755
|
/**
|
|
756
756
|
* @method
|
|
757
|
-
* @name
|
|
757
|
+
* @name mexc#watchOrders
|
|
758
758
|
* @see https://mxcdevelop.github.io/apidocs/spot_v3_en/#spot-account-orders
|
|
759
759
|
* @see https://mxcdevelop.github.io/apidocs/spot_v3_en/#margin-account-orders
|
|
760
760
|
* @description watches information on multiple orders made by the user
|
|
@@ -1006,7 +1006,7 @@ class mexc extends mexc$1 {
|
|
|
1006
1006
|
async watchBalance(params = {}) {
|
|
1007
1007
|
/**
|
|
1008
1008
|
* @method
|
|
1009
|
-
* @name
|
|
1009
|
+
* @name mexc#watchBalance
|
|
1010
1010
|
* @see https://mxcdevelop.github.io/apidocs/spot_v3_en/#spot-account-upadte
|
|
1011
1011
|
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
1012
1012
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain, Conversion } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.3.
|
|
7
|
+
declare const version = "4.3.31";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.3.
|
|
41
|
+
const version = '4.3.32';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -3,8 +3,8 @@ import { // eslint-disable-line object-curly-newline
|
|
|
3
3
|
ExchangeError, AuthenticationError, DDoSProtection, RequestTimeout, ExchangeNotAvailable, RateLimitExceeded } from "./errors.js";
|
|
4
4
|
import WsClient from './ws/WsClient.js';
|
|
5
5
|
import { OrderBook as WsOrderBook, IndexedOrderBook, CountedOrderBook } from './ws/OrderBook.js';
|
|
6
|
-
import type { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRate, DepositWithdrawFeeNetwork, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CancellationRequest, IsolatedBorrowRate, IsolatedBorrowRates, CrossBorrowRates, CrossBorrowRate, Dict, TransferEntries, FundingRates, LeverageTiers } from './types.js';
|
|
7
|
-
export type { Market, Trade, Fee, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, CrossBorrowRate, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings, Conversion } from './types.js';
|
|
6
|
+
import type { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRate, DepositWithdrawFeeNetwork, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CancellationRequest, IsolatedBorrowRate, IsolatedBorrowRates, CrossBorrowRates, CrossBorrowRate, Dict, TransferEntries, FundingRates, LeverageTiers, Bool } from './types.js';
|
|
7
|
+
export type { Market, Trade, Fee, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, Bool, OrderType, OrderSide, Position, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, CrossBorrowRate, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings, Conversion } from './types.js';
|
|
8
8
|
import { ArrayCache, ArrayCacheByTimestamp } from './ws/Cache.js';
|
|
9
9
|
import { OrderBook as Ob } from './ws/OrderBook.js';
|
|
10
10
|
/**
|
|
@@ -848,6 +848,8 @@ export default class Exchange {
|
|
|
848
848
|
handleParamString2(params: object, paramName1: string, paramName2: string, defaultValue?: Str): [string, object];
|
|
849
849
|
handleParamInteger(params: object, paramName: string, defaultValue?: Int): [Int, object];
|
|
850
850
|
handleParamInteger2(params: object, paramName1: string, paramName2: string, defaultValue?: Int): [Int, object];
|
|
851
|
+
handleParamBool(params: object, paramName: string, defaultValue?: Bool): [Bool, object];
|
|
852
|
+
handleParamBool2(params: object, paramName1: string, paramName2: string, defaultValue?: Bool): [Bool, object];
|
|
851
853
|
resolvePath(path: any, params: any): any[];
|
|
852
854
|
getListFromObjectValues(objects: any, key: IndexType): any[];
|
|
853
855
|
getSymbolsForMarketType(marketType?: Str, subType?: Str, symbolWithActiveStatus?: boolean, symbolWithUnknownStatus?: boolean): any[];
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -3683,6 +3683,20 @@ export default class Exchange {
|
|
|
3683
3683
|
}
|
|
3684
3684
|
return [value, params];
|
|
3685
3685
|
}
|
|
3686
|
+
handleParamBool(params, paramName, defaultValue = undefined) {
|
|
3687
|
+
const value = this.safeBool(params, paramName, defaultValue);
|
|
3688
|
+
if (value !== undefined) {
|
|
3689
|
+
params = this.omit(params, paramName);
|
|
3690
|
+
}
|
|
3691
|
+
return [value, params];
|
|
3692
|
+
}
|
|
3693
|
+
handleParamBool2(params, paramName1, paramName2, defaultValue = undefined) {
|
|
3694
|
+
const value = this.safeBool2(params, paramName1, paramName2, defaultValue);
|
|
3695
|
+
if (value !== undefined) {
|
|
3696
|
+
params = this.omit(params, [paramName1, paramName2]);
|
|
3697
|
+
}
|
|
3698
|
+
return [value, params];
|
|
3699
|
+
}
|
|
3686
3700
|
resolvePath(path, params) {
|
|
3687
3701
|
return [
|
|
3688
3702
|
this.implodeParams(path, params),
|
package/js/src/coinex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/coinex.js';
|
|
2
|
-
import type { Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, OHLCV, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, OrderRequest, TransferEntry, Leverage,
|
|
2
|
+
import type { Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, OHLCV, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, OrderRequest, TransferEntry, Leverage, Num, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position, IsolatedBorrowRate, Dict, TransferEntries, LeverageTiers, LeverageTier } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class coinex
|
|
5
5
|
* @augments Exchange
|
|
@@ -155,7 +155,7 @@ export default class coinex extends Exchange {
|
|
|
155
155
|
};
|
|
156
156
|
fetchDepositWithdrawFee(code: string, params?: {}): Promise<any>;
|
|
157
157
|
parseDepositWithdrawFee(fee: any, currency?: Currency): Dict;
|
|
158
|
-
|
|
158
|
+
fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
|
|
159
159
|
parseLeverage(leverage: Dict, market?: Market): Leverage;
|
|
160
160
|
fetchPositionHistory(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Position>;
|
|
161
161
|
handleMarginModeAndParams(methodName: any, params?: {}, defaultValue?: any): any[];
|
package/js/src/coinex.js
CHANGED
|
@@ -80,8 +80,8 @@ export default class coinex extends Exchange {
|
|
|
80
80
|
'fetchIndexOHLCV': false,
|
|
81
81
|
'fetchIsolatedBorrowRate': true,
|
|
82
82
|
'fetchIsolatedBorrowRates': false,
|
|
83
|
-
'fetchLeverage':
|
|
84
|
-
'fetchLeverages':
|
|
83
|
+
'fetchLeverage': true,
|
|
84
|
+
'fetchLeverages': false,
|
|
85
85
|
'fetchLeverageTiers': true,
|
|
86
86
|
'fetchMarginAdjustmentHistory': true,
|
|
87
87
|
'fetchMarketLeverageTiers': 'emulated',
|
|
@@ -5526,61 +5526,64 @@ export default class coinex extends Exchange {
|
|
|
5526
5526
|
}
|
|
5527
5527
|
return result;
|
|
5528
5528
|
}
|
|
5529
|
-
async
|
|
5529
|
+
async fetchLeverage(symbol, params = {}) {
|
|
5530
5530
|
/**
|
|
5531
5531
|
* @method
|
|
5532
|
-
* @name coinex#
|
|
5533
|
-
* @description fetch the set leverage for
|
|
5534
|
-
* @see https://
|
|
5535
|
-
* @param {string
|
|
5532
|
+
* @name coinex#fetchLeverage
|
|
5533
|
+
* @description fetch the set leverage for a market
|
|
5534
|
+
* @see https://docs.coinex.com/api/v2/assets/loan-flat/http/list-margin-interest-limit
|
|
5535
|
+
* @param {string} symbol unified market symbol
|
|
5536
5536
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5537
|
-
* @
|
|
5537
|
+
* @param {string} params.code unified currency code
|
|
5538
|
+
* @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
5538
5539
|
*/
|
|
5539
5540
|
await this.loadMarkets();
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
const symbol = this.safeValue(symbols, 0);
|
|
5544
|
-
market = this.market(symbol);
|
|
5545
|
-
}
|
|
5546
|
-
let marketType = undefined;
|
|
5547
|
-
[marketType, params] = this.handleMarketTypeAndParams('fetchLeverages', market, params);
|
|
5548
|
-
if (marketType !== 'spot') {
|
|
5549
|
-
throw new NotSupported(this.id + ' fetchLeverages() supports spot margin markets only');
|
|
5541
|
+
const code = this.safeString(params, 'code');
|
|
5542
|
+
if (code === undefined) {
|
|
5543
|
+
throw new ArgumentsRequired(this.id + ' fetchLeverage() requires a code parameter');
|
|
5550
5544
|
}
|
|
5551
|
-
|
|
5545
|
+
params = this.omit(params, 'code');
|
|
5546
|
+
const currency = this.currency(code);
|
|
5547
|
+
const market = this.market(symbol);
|
|
5548
|
+
const request = {
|
|
5549
|
+
'market': market['id'],
|
|
5550
|
+
'ccy': currency['id'],
|
|
5551
|
+
};
|
|
5552
|
+
const response = await this.v2PrivateGetAssetsMarginInterestLimit(this.extend(request, params));
|
|
5552
5553
|
//
|
|
5553
5554
|
// {
|
|
5554
5555
|
// "code": 0,
|
|
5555
|
-
// "data":
|
|
5556
|
-
//
|
|
5557
|
-
//
|
|
5558
|
-
//
|
|
5559
|
-
//
|
|
5560
|
-
//
|
|
5561
|
-
//
|
|
5562
|
-
//
|
|
5563
|
-
//
|
|
5564
|
-
// "USDT": {
|
|
5565
|
-
// "min_amount": "50",
|
|
5566
|
-
// "max_amount": "500000",
|
|
5567
|
-
// "day_rate": "0.001"
|
|
5568
|
-
// }
|
|
5569
|
-
// },
|
|
5570
|
-
// ],
|
|
5571
|
-
// "message": "Success"
|
|
5556
|
+
// "data": {
|
|
5557
|
+
// "market": "BTCUSDT",
|
|
5558
|
+
// "ccy": "USDT",
|
|
5559
|
+
// "leverage": 10,
|
|
5560
|
+
// "min_amount": "50",
|
|
5561
|
+
// "max_amount": "500000",
|
|
5562
|
+
// "daily_interest_rate": "0.001"
|
|
5563
|
+
// },
|
|
5564
|
+
// "message": "OK"
|
|
5572
5565
|
// }
|
|
5573
5566
|
//
|
|
5574
|
-
const
|
|
5575
|
-
return this.
|
|
5567
|
+
const data = this.safeDict(response, 'data', {});
|
|
5568
|
+
return this.parseLeverage(data, market);
|
|
5576
5569
|
}
|
|
5577
5570
|
parseLeverage(leverage, market = undefined) {
|
|
5571
|
+
//
|
|
5572
|
+
// {
|
|
5573
|
+
// "market": "BTCUSDT",
|
|
5574
|
+
// "ccy": "USDT",
|
|
5575
|
+
// "leverage": 10,
|
|
5576
|
+
// "min_amount": "50",
|
|
5577
|
+
// "max_amount": "500000",
|
|
5578
|
+
// "daily_interest_rate": "0.001"
|
|
5579
|
+
// }
|
|
5580
|
+
//
|
|
5578
5581
|
const marketId = this.safeString(leverage, 'market');
|
|
5579
5582
|
const leverageValue = this.safeInteger(leverage, 'leverage');
|
|
5580
5583
|
return {
|
|
5581
5584
|
'info': leverage,
|
|
5582
5585
|
'symbol': this.safeSymbol(marketId, market, undefined, 'spot'),
|
|
5583
|
-
'marginMode':
|
|
5586
|
+
'marginMode': 'isolated',
|
|
5584
5587
|
'longLeverage': leverageValue,
|
|
5585
5588
|
'shortLeverage': leverageValue,
|
|
5586
5589
|
};
|
package/js/src/pro/cex.js
CHANGED
|
@@ -979,7 +979,7 @@ export default class cex extends cexRest {
|
|
|
979
979
|
const symbol = this.pairToSymbol(pair);
|
|
980
980
|
const messageHash = 'orderbook:' + symbol;
|
|
981
981
|
const timestamp = this.safeInteger2(data, 'timestamp_ms', 'timestamp');
|
|
982
|
-
const incrementalId = this.
|
|
982
|
+
const incrementalId = this.safeInteger(data, 'id');
|
|
983
983
|
const orderbook = this.orderBook({});
|
|
984
984
|
const snapshot = this.parseOrderBook(data, symbol, timestamp, 'bids', 'asks');
|
|
985
985
|
snapshot['nonce'] = incrementalId;
|
package/js/src/pro/coinbase.js
CHANGED
|
@@ -247,6 +247,34 @@ export default class coinbase extends coinbaseRest {
|
|
|
247
247
|
// ]
|
|
248
248
|
// }
|
|
249
249
|
//
|
|
250
|
+
// note! seems coinbase might also send empty data like:
|
|
251
|
+
//
|
|
252
|
+
// {
|
|
253
|
+
// "channel": "ticker_batch",
|
|
254
|
+
// "client_id": "",
|
|
255
|
+
// "timestamp": "2024-05-24T18:22:24.546809523Z",
|
|
256
|
+
// "sequence_num": 1,
|
|
257
|
+
// "events": [
|
|
258
|
+
// {
|
|
259
|
+
// "type": "snapshot",
|
|
260
|
+
// "tickers": [
|
|
261
|
+
// {
|
|
262
|
+
// "type": "ticker",
|
|
263
|
+
// "product_id": "",
|
|
264
|
+
// "price": "",
|
|
265
|
+
// "volume_24_h": "",
|
|
266
|
+
// "low_24_h": "",
|
|
267
|
+
// "high_24_h": "",
|
|
268
|
+
// "low_52_w": "",
|
|
269
|
+
// "high_52_w": "",
|
|
270
|
+
// "price_percent_chg_24_h": ""
|
|
271
|
+
// }
|
|
272
|
+
// ]
|
|
273
|
+
// }
|
|
274
|
+
// ]
|
|
275
|
+
// }
|
|
276
|
+
//
|
|
277
|
+
//
|
|
250
278
|
const channel = this.safeString(message, 'channel');
|
|
251
279
|
const events = this.safeValue(message, 'events', []);
|
|
252
280
|
const datetime = this.safeString(message, 'timestamp');
|
|
@@ -263,6 +291,9 @@ export default class coinbase extends coinbaseRest {
|
|
|
263
291
|
const symbol = result['symbol'];
|
|
264
292
|
this.tickers[symbol] = result;
|
|
265
293
|
const wsMarketId = this.safeString(ticker, 'product_id');
|
|
294
|
+
if (wsMarketId === undefined) {
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
266
297
|
const messageHash = channel + '::' + wsMarketId;
|
|
267
298
|
newTickers.push(result);
|
|
268
299
|
client.resolve(result, messageHash);
|
package/js/src/pro/mexc.js
CHANGED
|
@@ -72,7 +72,7 @@ export default class mexc extends mexcRest {
|
|
|
72
72
|
async watchTicker(symbol, params = {}) {
|
|
73
73
|
/**
|
|
74
74
|
* @method
|
|
75
|
-
* @name
|
|
75
|
+
* @name mexc#watchTicker
|
|
76
76
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
77
77
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
78
78
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -205,7 +205,7 @@ export default class mexc extends mexcRest {
|
|
|
205
205
|
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
206
206
|
/**
|
|
207
207
|
* @method
|
|
208
|
-
* @name
|
|
208
|
+
* @name mexc#watchOHLCV
|
|
209
209
|
* @see https://mxcdevelop.github.io/apidocs/spot_v3_en/#kline-streams
|
|
210
210
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
211
211
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
@@ -351,7 +351,7 @@ export default class mexc extends mexcRest {
|
|
|
351
351
|
async watchOrderBook(symbol, limit = undefined, params = {}) {
|
|
352
352
|
/**
|
|
353
353
|
* @method
|
|
354
|
-
* @name
|
|
354
|
+
* @name mexc#watchOrderBook
|
|
355
355
|
* @see https://mxcdevelop.github.io/apidocs/spot_v3_en/#diff-depth-stream
|
|
356
356
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
357
357
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
@@ -521,7 +521,7 @@ export default class mexc extends mexcRest {
|
|
|
521
521
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
522
522
|
/**
|
|
523
523
|
* @method
|
|
524
|
-
* @name
|
|
524
|
+
* @name mexc#watchTrades
|
|
525
525
|
* @see https://mxcdevelop.github.io/apidocs/spot_v3_en/#trade-streams
|
|
526
526
|
* @description get the list of most recent trades for a particular symbol
|
|
527
527
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
@@ -610,7 +610,7 @@ export default class mexc extends mexcRest {
|
|
|
610
610
|
async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
611
611
|
/**
|
|
612
612
|
* @method
|
|
613
|
-
* @name
|
|
613
|
+
* @name mexc#watchMyTrades
|
|
614
614
|
* @see https://mxcdevelop.github.io/apidocs/spot_v3_en/#spot-account-deals
|
|
615
615
|
* @description watches information on multiple trades made by the user
|
|
616
616
|
* @param {string} symbol unified market symbol of the market trades were made in
|
|
@@ -757,7 +757,7 @@ export default class mexc extends mexcRest {
|
|
|
757
757
|
async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
758
758
|
/**
|
|
759
759
|
* @method
|
|
760
|
-
* @name
|
|
760
|
+
* @name mexc#watchOrders
|
|
761
761
|
* @see https://mxcdevelop.github.io/apidocs/spot_v3_en/#spot-account-orders
|
|
762
762
|
* @see https://mxcdevelop.github.io/apidocs/spot_v3_en/#margin-account-orders
|
|
763
763
|
* @description watches information on multiple orders made by the user
|
|
@@ -1009,7 +1009,7 @@ export default class mexc extends mexcRest {
|
|
|
1009
1009
|
async watchBalance(params = {}) {
|
|
1010
1010
|
/**
|
|
1011
1011
|
* @method
|
|
1012
|
-
* @name
|
|
1012
|
+
* @name mexc#watchBalance
|
|
1013
1013
|
* @see https://mxcdevelop.github.io/apidocs/spot_v3_en/#spot-account-upadte
|
|
1014
1014
|
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
1015
1015
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
package/package.json
CHANGED