ccxt 4.3.33 → 4.3.35
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/alpaca.js +1 -1
- package/dist/cjs/src/base/Exchange.js +37 -0
- package/dist/cjs/src/binance.js +1 -0
- package/dist/cjs/src/bitmart.js +2 -9
- package/dist/cjs/src/coinbase.js +169 -55
- package/dist/cjs/src/coinex.js +26 -19
- package/dist/cjs/src/kraken.js +3 -1
- package/dist/cjs/src/pro/binance.js +352 -0
- package/dist/cjs/src/pro/bitget.js +31 -1
- package/dist/cjs/src/pro/bitmex.js +108 -0
- package/dist/cjs/src/pro/bybit.js +85 -0
- package/dist/cjs/src/pro/gate.js +183 -0
- package/dist/cjs/src/pro/kucoinfutures.js +4 -0
- package/dist/cjs/src/pro/okx.js +258 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- 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/ace.d.ts +3 -3
- package/js/src/alpaca.d.ts +3 -3
- package/js/src/alpaca.js +1 -1
- package/js/src/ascendex.d.ts +3 -3
- package/js/src/base/Exchange.d.ts +14 -3
- package/js/src/base/Exchange.js +37 -0
- package/js/src/base/types.d.ts +1 -0
- package/js/src/bigone.d.ts +3 -3
- package/js/src/binance.d.ts +4 -4
- package/js/src/binance.js +1 -0
- package/js/src/bingx.d.ts +3 -3
- package/js/src/bit2c.d.ts +2 -2
- package/js/src/bitbank.d.ts +2 -2
- package/js/src/bitbns.d.ts +2 -2
- package/js/src/bitfinex.d.ts +3 -3
- package/js/src/bitfinex2.d.ts +1 -1
- package/js/src/bitflyer.d.ts +2 -2
- package/js/src/bitget.d.ts +4 -4
- package/js/src/bithumb.d.ts +2 -2
- package/js/src/bitmart.d.ts +3 -3
- package/js/src/bitmart.js +2 -9
- package/js/src/bitmex.d.ts +4 -4
- package/js/src/bitopro.d.ts +4 -4
- package/js/src/bitrue.d.ts +3 -3
- package/js/src/bitso.d.ts +3 -3
- package/js/src/bitstamp.d.ts +3 -3
- package/js/src/bitteam.d.ts +4 -4
- package/js/src/bitvavo.d.ts +3 -3
- package/js/src/blockchaincom.d.ts +2 -2
- package/js/src/blofin.d.ts +4 -4
- package/js/src/btcalpha.d.ts +4 -4
- package/js/src/btcbox.d.ts +2 -2
- package/js/src/btcmarkets.d.ts +4 -4
- package/js/src/btcturk.d.ts +2 -2
- package/js/src/bybit.d.ts +3 -3
- package/js/src/cex.d.ts +2 -2
- package/js/src/coinbase.d.ts +4 -3
- package/js/src/coinbase.js +169 -55
- package/js/src/coinbaseexchange.d.ts +2 -2
- package/js/src/coinbaseinternational.d.ts +4 -4
- package/js/src/coincheck.d.ts +3 -3
- package/js/src/coinex.d.ts +3 -3
- package/js/src/coinex.js +26 -19
- package/js/src/coinlist.d.ts +3 -3
- package/js/src/coinmate.d.ts +3 -3
- package/js/src/coinmetro.d.ts +3 -3
- package/js/src/coinone.d.ts +2 -2
- package/js/src/coinsph.d.ts +3 -3
- package/js/src/cryptocom.d.ts +2 -2
- package/js/src/currencycom.d.ts +3 -3
- package/js/src/delta.d.ts +2 -2
- package/js/src/deribit.d.ts +3 -3
- package/js/src/digifinex.d.ts +3 -3
- package/js/src/exmo.d.ts +3 -3
- package/js/src/gate.d.ts +3 -3
- package/js/src/gemini.d.ts +3 -3
- package/js/src/hitbtc.d.ts +3 -3
- package/js/src/hollaex.d.ts +2 -2
- package/js/src/htx.d.ts +3 -3
- package/js/src/huobijp.d.ts +3 -3
- package/js/src/hyperliquid.d.ts +3 -3
- package/js/src/idex.d.ts +3 -3
- package/js/src/indodax.d.ts +3 -3
- package/js/src/kraken.d.ts +3 -3
- package/js/src/kraken.js +3 -1
- package/js/src/krakenfutures.d.ts +2 -2
- package/js/src/kucoin.d.ts +3 -3
- package/js/src/kuna.d.ts +3 -3
- package/js/src/latoken.d.ts +3 -3
- package/js/src/lbank.d.ts +2 -2
- package/js/src/luno.d.ts +2 -2
- package/js/src/lykke.d.ts +2 -2
- package/js/src/mercado.d.ts +2 -2
- package/js/src/mexc.d.ts +2 -2
- package/js/src/ndax.d.ts +3 -3
- package/js/src/novadax.d.ts +4 -4
- package/js/src/oceanex.d.ts +3 -3
- package/js/src/okcoin.d.ts +4 -4
- package/js/src/okx.d.ts +4 -4
- package/js/src/onetrading.d.ts +3 -3
- package/js/src/p2b.d.ts +3 -3
- package/js/src/paymium.d.ts +2 -2
- package/js/src/phemex.d.ts +5 -5
- package/js/src/poloniex.d.ts +4 -4
- package/js/src/poloniexfutures.d.ts +3 -3
- package/js/src/pro/binance.d.ts +9 -2
- package/js/src/pro/binance.js +352 -0
- package/js/src/pro/bitget.js +31 -1
- package/js/src/pro/bitmex.d.ts +4 -1
- package/js/src/pro/bitmex.js +108 -0
- package/js/src/pro/bybit.d.ts +4 -1
- package/js/src/pro/bybit.js +85 -0
- package/js/src/pro/gate.d.ts +5 -1
- package/js/src/pro/gate.js +183 -0
- package/js/src/pro/kucoinfutures.js +4 -0
- package/js/src/pro/okx.d.ts +8 -1
- package/js/src/pro/okx.js +258 -0
- package/js/src/probit.d.ts +4 -4
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/js/src/timex.d.ts +3 -3
- package/js/src/tokocrypto.d.ts +2 -2
- package/js/src/tradeogre.d.ts +2 -2
- package/js/src/upbit.d.ts +4 -4
- package/js/src/wavesexchange.d.ts +2 -2
- package/js/src/wazirx.d.ts +4 -4
- package/js/src/whitebit.d.ts +4 -4
- package/js/src/woo.d.ts +4 -4
- package/js/src/woofipro.d.ts +4 -4
- package/js/src/yobit.d.ts +2 -2
- package/js/src/zaif.d.ts +3 -3
- package/js/src/zonda.d.ts +2 -2
- 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.35';
|
|
189
189
|
Exchange["default"].ccxtVersion = version;
|
|
190
190
|
const exchanges = {
|
|
191
191
|
'ace': ace,
|
package/dist/cjs/src/alpaca.js
CHANGED
|
@@ -791,7 +791,7 @@ class alpaca extends alpaca$1 {
|
|
|
791
791
|
// "message": "order is not found."
|
|
792
792
|
// }
|
|
793
793
|
//
|
|
794
|
-
return this.
|
|
794
|
+
return this.parseOrder(response);
|
|
795
795
|
}
|
|
796
796
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
797
797
|
/**
|
|
@@ -81,6 +81,7 @@ class Exchange {
|
|
|
81
81
|
this.verbose = false;
|
|
82
82
|
this.twofa = undefined; // two-factor authentication (2FA)
|
|
83
83
|
this.balance = {};
|
|
84
|
+
this.liquidations = {};
|
|
84
85
|
this.orderbooks = {};
|
|
85
86
|
this.tickers = {};
|
|
86
87
|
this.fundingRates = {};
|
|
@@ -88,6 +89,7 @@ class Exchange {
|
|
|
88
89
|
this.orders = undefined;
|
|
89
90
|
this.triggerOrders = undefined;
|
|
90
91
|
this.transactions = {};
|
|
92
|
+
this.myLiquidations = {};
|
|
91
93
|
this.requiresWeb3 = false;
|
|
92
94
|
this.requiresEddsa = false;
|
|
93
95
|
this.enableLastJsonResponse = true;
|
|
@@ -285,10 +287,12 @@ class Exchange {
|
|
|
285
287
|
this.balance = {};
|
|
286
288
|
this.orderbooks = {};
|
|
287
289
|
this.tickers = {};
|
|
290
|
+
this.liquidations = {};
|
|
288
291
|
this.orders = undefined;
|
|
289
292
|
this.trades = {};
|
|
290
293
|
this.transactions = {};
|
|
291
294
|
this.ohlcvs = {};
|
|
295
|
+
this.myLiquidations = {};
|
|
292
296
|
this.myTrades = undefined;
|
|
293
297
|
this.positions = undefined;
|
|
294
298
|
// web3 and cryptography flags
|
|
@@ -573,6 +577,10 @@ class Exchange {
|
|
|
573
577
|
'watchTickers': undefined,
|
|
574
578
|
'watchTrades': undefined,
|
|
575
579
|
'watchTradesForSymbols': undefined,
|
|
580
|
+
'watchLiquidations': undefined,
|
|
581
|
+
'watchLiquidationsForSymbols': undefined,
|
|
582
|
+
'watchMyLiquidations': undefined,
|
|
583
|
+
'watchMyLiquidationsForSymbols': undefined,
|
|
576
584
|
'withdraw': undefined,
|
|
577
585
|
'ws': undefined,
|
|
578
586
|
},
|
|
@@ -1927,6 +1935,24 @@ class Exchange {
|
|
|
1927
1935
|
async fetchTradesWs(symbol, since = undefined, limit = undefined, params = {}) {
|
|
1928
1936
|
throw new errors.NotSupported(this.id + ' fetchTradesWs() is not supported yet');
|
|
1929
1937
|
}
|
|
1938
|
+
async watchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
|
|
1939
|
+
if (this.has['watchLiquidationsForSymbols']) {
|
|
1940
|
+
return this.watchLiquidationsForSymbols([symbol], since, limit, params);
|
|
1941
|
+
}
|
|
1942
|
+
throw new errors.NotSupported(this.id + ' watchLiquidations() is not supported yet');
|
|
1943
|
+
}
|
|
1944
|
+
async watchLiquidationsForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
1945
|
+
throw new errors.NotSupported(this.id + ' watchLiquidationsForSymbols() is not supported yet');
|
|
1946
|
+
}
|
|
1947
|
+
async watchMyLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
|
|
1948
|
+
if (this.has['watchMyLiquidationsForSymbols']) {
|
|
1949
|
+
return this.watchMyLiquidationsForSymbols([symbol], since, limit, params);
|
|
1950
|
+
}
|
|
1951
|
+
throw new errors.NotSupported(this.id + ' watchMyLiquidations() is not supported yet');
|
|
1952
|
+
}
|
|
1953
|
+
async watchMyLiquidationsForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
1954
|
+
throw new errors.NotSupported(this.id + ' watchMyLiquidationsForSymbols() is not supported yet');
|
|
1955
|
+
}
|
|
1930
1956
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
1931
1957
|
throw new errors.NotSupported(this.id + ' watchTrades() is not supported yet');
|
|
1932
1958
|
}
|
|
@@ -2936,6 +2962,17 @@ class Exchange {
|
|
|
2936
2962
|
trade['cost'] = this.parseNumber(cost);
|
|
2937
2963
|
return trade;
|
|
2938
2964
|
}
|
|
2965
|
+
findNearestCeiling(arr, providedValue) {
|
|
2966
|
+
// i.e. findNearestCeiling ([ 10, 30, 50], 23) returns 30
|
|
2967
|
+
const length = arr.length;
|
|
2968
|
+
for (let i = 0; i < length; i++) {
|
|
2969
|
+
const current = arr[i];
|
|
2970
|
+
if (providedValue <= current) {
|
|
2971
|
+
return current;
|
|
2972
|
+
}
|
|
2973
|
+
}
|
|
2974
|
+
return arr[length - 1];
|
|
2975
|
+
}
|
|
2939
2976
|
invertFlatStringDictionary(dict) {
|
|
2940
2977
|
const reversed = {};
|
|
2941
2978
|
const keys = Object.keys(dict);
|
package/dist/cjs/src/binance.js
CHANGED
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -1182,16 +1182,9 @@ class bitmart extends bitmart$1 {
|
|
|
1182
1182
|
market = this.safeMarket(marketId, market);
|
|
1183
1183
|
const symbol = market['symbol'];
|
|
1184
1184
|
const last = this.safeString2(ticker, 'close_24h', 'last_price');
|
|
1185
|
-
let percentage = this.safeString(ticker, 'price_change_percent_24h');
|
|
1185
|
+
let percentage = Precise["default"].stringAbs(this.safeString(ticker, 'price_change_percent_24h'));
|
|
1186
1186
|
if (percentage === undefined) {
|
|
1187
|
-
|
|
1188
|
-
if ((percentageRaw !== undefined) && (percentageRaw !== '0')) { // a few tickers show strictly '0' in fluctuation field
|
|
1189
|
-
const direction = percentageRaw[0];
|
|
1190
|
-
percentage = direction + Precise["default"].stringMul(percentageRaw.replace(direction, ''), '100');
|
|
1191
|
-
}
|
|
1192
|
-
else if (percentageRaw === '0') {
|
|
1193
|
-
percentage = '0';
|
|
1194
|
-
}
|
|
1187
|
+
percentage = Precise["default"].stringAbs(Precise["default"].stringMul(this.safeString(ticker, 'fluctuation'), '100'));
|
|
1195
1188
|
}
|
|
1196
1189
|
let baseVolume = this.safeString(ticker, 'base_volume_24h');
|
|
1197
1190
|
let quoteVolume = this.safeString(ticker, 'quote_volume_24h');
|
package/dist/cjs/src/coinbase.js
CHANGED
|
@@ -111,8 +111,8 @@ class coinbase extends coinbase$1 {
|
|
|
111
111
|
'fetchTickers': true,
|
|
112
112
|
'fetchTime': true,
|
|
113
113
|
'fetchTrades': true,
|
|
114
|
-
'fetchTradingFee':
|
|
115
|
-
'fetchTradingFees':
|
|
114
|
+
'fetchTradingFee': 'emulated',
|
|
115
|
+
'fetchTradingFees': true,
|
|
116
116
|
'fetchWithdrawals': true,
|
|
117
117
|
'reduceMargin': false,
|
|
118
118
|
'setLeverage': false,
|
|
@@ -342,6 +342,7 @@ class coinbase extends coinbase$1 {
|
|
|
342
342
|
'CGLD': 'CELO',
|
|
343
343
|
},
|
|
344
344
|
'options': {
|
|
345
|
+
'usePrivate': false,
|
|
345
346
|
'brokerId': 'ccxt',
|
|
346
347
|
'stablePairs': ['BUSD-USD', 'CBETH-ETH', 'DAI-USD', 'GUSD-USD', 'GYEN-USD', 'PAX-USD', 'PAX-USDT', 'USDC-EUR', 'USDC-GBP', 'USDT-EUR', 'USDT-GBP', 'USDT-USD', 'USDT-USDC', 'WBTC-BTC'],
|
|
347
348
|
'fetchCurrencies': {
|
|
@@ -1105,6 +1106,7 @@ class coinbase extends coinbase$1 {
|
|
|
1105
1106
|
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
|
|
1106
1107
|
* @description retrieves data on all markets for coinbase
|
|
1107
1108
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1109
|
+
* @param {boolean} [params.usePrivate] use private endpoint for fetching markets
|
|
1108
1110
|
* @returns {object[]} an array of objects representing market data
|
|
1109
1111
|
*/
|
|
1110
1112
|
const method = this.safeString(this.options, 'fetchMarkets', 'fetchMarketsV3');
|
|
@@ -1186,54 +1188,60 @@ class coinbase extends coinbase$1 {
|
|
|
1186
1188
|
return result;
|
|
1187
1189
|
}
|
|
1188
1190
|
async fetchMarketsV3(params = {}) {
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1191
|
+
let usePrivate = false;
|
|
1192
|
+
[usePrivate, params] = this.handleOptionAndParams(params, 'fetchMarkets', 'usePrivate', false);
|
|
1193
|
+
const spotUnresolvedPromises = [];
|
|
1194
|
+
if (usePrivate) {
|
|
1195
|
+
spotUnresolvedPromises.push(this.v3PrivateGetBrokerageProducts(params));
|
|
1196
|
+
}
|
|
1197
|
+
else {
|
|
1198
|
+
spotUnresolvedPromises.push(this.v3PublicGetBrokerageMarketProducts(params));
|
|
1199
|
+
}
|
|
1200
|
+
//
|
|
1201
|
+
// {
|
|
1202
|
+
// products: [
|
|
1203
|
+
// {
|
|
1204
|
+
// product_id: 'BTC-USD',
|
|
1205
|
+
// price: '67060',
|
|
1206
|
+
// price_percentage_change_24h: '3.30054960636883',
|
|
1207
|
+
// volume_24h: '10967.87426597',
|
|
1208
|
+
// volume_percentage_change_24h: '141.73048325503036',
|
|
1209
|
+
// base_increment: '0.00000001',
|
|
1210
|
+
// quote_increment: '0.01',
|
|
1211
|
+
// quote_min_size: '1',
|
|
1212
|
+
// quote_max_size: '150000000',
|
|
1213
|
+
// base_min_size: '0.00000001',
|
|
1214
|
+
// base_max_size: '3400',
|
|
1215
|
+
// base_name: 'Bitcoin',
|
|
1216
|
+
// quote_name: 'US Dollar',
|
|
1217
|
+
// watched: false,
|
|
1218
|
+
// is_disabled: false,
|
|
1219
|
+
// new: false,
|
|
1220
|
+
// status: 'online',
|
|
1221
|
+
// cancel_only: false,
|
|
1222
|
+
// limit_only: false,
|
|
1223
|
+
// post_only: false,
|
|
1224
|
+
// trading_disabled: false,
|
|
1225
|
+
// auction_mode: false,
|
|
1226
|
+
// product_type: 'SPOT',
|
|
1227
|
+
// quote_currency_id: 'USD',
|
|
1228
|
+
// base_currency_id: 'BTC',
|
|
1229
|
+
// fcm_trading_session_details: null,
|
|
1230
|
+
// mid_market_price: '',
|
|
1231
|
+
// alias: '',
|
|
1232
|
+
// alias_to: [ 'BTC-USDC' ],
|
|
1233
|
+
// base_display_symbol: 'BTC',
|
|
1234
|
+
// quote_display_symbol: 'USD',
|
|
1235
|
+
// view_only: false,
|
|
1236
|
+
// price_increment: '0.01',
|
|
1237
|
+
// display_name: 'BTC-USD',
|
|
1238
|
+
// product_venue: 'CBE'
|
|
1239
|
+
// },
|
|
1240
|
+
// ...
|
|
1241
|
+
// ],
|
|
1242
|
+
// num_products: '646'
|
|
1243
|
+
// }
|
|
1244
|
+
//
|
|
1237
1245
|
if (this.checkRequiredCredentials(false)) {
|
|
1238
1246
|
spotUnresolvedPromises.push(this.v3PrivateGetBrokerageTransactionSummary(params));
|
|
1239
1247
|
}
|
|
@@ -1761,6 +1769,7 @@ class coinbase extends coinbase$1 {
|
|
|
1761
1769
|
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
|
|
1762
1770
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1763
1771
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1772
|
+
* @param {boolean} [params.usePrivate] use private endpoint for fetching tickers
|
|
1764
1773
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1765
1774
|
*/
|
|
1766
1775
|
const method = this.safeString(this.options, 'fetchTickers', 'fetchTickersV3');
|
|
@@ -1815,7 +1824,15 @@ class coinbase extends coinbase$1 {
|
|
|
1815
1824
|
if (marketType !== undefined && marketType !== 'default') {
|
|
1816
1825
|
request['product_type'] = (marketType === 'swap') ? 'FUTURE' : 'SPOT';
|
|
1817
1826
|
}
|
|
1818
|
-
|
|
1827
|
+
let response = undefined;
|
|
1828
|
+
let usePrivate = false;
|
|
1829
|
+
[usePrivate, params] = this.handleOptionAndParams(params, 'fetchTickers', 'usePrivate', false);
|
|
1830
|
+
if (usePrivate) {
|
|
1831
|
+
response = await this.v3PrivateGetBrokerageProducts(this.extend(request, params));
|
|
1832
|
+
}
|
|
1833
|
+
else {
|
|
1834
|
+
response = await this.v3PublicGetBrokerageMarketProducts(this.extend(request, params));
|
|
1835
|
+
}
|
|
1819
1836
|
//
|
|
1820
1837
|
// {
|
|
1821
1838
|
// "products": [
|
|
@@ -1875,6 +1892,7 @@ class coinbase extends coinbase$1 {
|
|
|
1875
1892
|
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices#get-sell-price
|
|
1876
1893
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1877
1894
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1895
|
+
* @param {boolean} [params.usePrivate] whether to use the private endpoint for fetching the ticker
|
|
1878
1896
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1879
1897
|
*/
|
|
1880
1898
|
const method = this.safeString(this.options, 'fetchTicker', 'fetchTickerV3');
|
|
@@ -1918,7 +1936,15 @@ class coinbase extends coinbase$1 {
|
|
|
1918
1936
|
'product_id': market['id'],
|
|
1919
1937
|
'limit': 1,
|
|
1920
1938
|
};
|
|
1921
|
-
|
|
1939
|
+
let usePrivate = false;
|
|
1940
|
+
[usePrivate, params] = this.handleOptionAndParams(params, 'fetchTicker', 'usePrivate', false);
|
|
1941
|
+
let response = undefined;
|
|
1942
|
+
if (usePrivate) {
|
|
1943
|
+
response = await this.v3PrivateGetBrokerageProductsProductIdTicker(this.extend(request, params));
|
|
1944
|
+
}
|
|
1945
|
+
else {
|
|
1946
|
+
response = await this.v3PublicGetBrokerageMarketProductsProductIdTicker(this.extend(request, params));
|
|
1947
|
+
}
|
|
1922
1948
|
//
|
|
1923
1949
|
// {
|
|
1924
1950
|
// "trades": [
|
|
@@ -3487,6 +3513,7 @@ class coinbase extends coinbase$1 {
|
|
|
3487
3513
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3488
3514
|
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
3489
3515
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
3516
|
+
* @param {boolean} [params.usePrivate] default false, when true will use the private endpoint to fetch the candles
|
|
3490
3517
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
3491
3518
|
*/
|
|
3492
3519
|
await this.loadMarkets();
|
|
@@ -3522,7 +3549,15 @@ class coinbase extends coinbase$1 {
|
|
|
3522
3549
|
// 300 candles max
|
|
3523
3550
|
request['end'] = Precise["default"].stringAdd(sinceString, requestedDuration.toString());
|
|
3524
3551
|
}
|
|
3525
|
-
|
|
3552
|
+
let response = undefined;
|
|
3553
|
+
let usePrivate = false;
|
|
3554
|
+
[usePrivate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'usePrivate', false);
|
|
3555
|
+
if (usePrivate) {
|
|
3556
|
+
response = await this.v3PrivateGetBrokerageProductsProductIdCandles(this.extend(request, params));
|
|
3557
|
+
}
|
|
3558
|
+
else {
|
|
3559
|
+
response = await this.v3PublicGetBrokerageMarketProductsProductIdCandles(this.extend(request, params));
|
|
3560
|
+
}
|
|
3526
3561
|
//
|
|
3527
3562
|
// {
|
|
3528
3563
|
// "candles": [
|
|
@@ -3572,6 +3607,7 @@ class coinbase extends coinbase$1 {
|
|
|
3572
3607
|
* @param {int} [since] not used by coinbase fetchTrades
|
|
3573
3608
|
* @param {int} [limit] the maximum number of trade structures to fetch
|
|
3574
3609
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3610
|
+
* @param {boolean} [params.usePrivate] default false, when true will use the private endpoint to fetch the trades
|
|
3575
3611
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
3576
3612
|
*/
|
|
3577
3613
|
await this.loadMarkets();
|
|
@@ -3593,7 +3629,15 @@ class coinbase extends coinbase$1 {
|
|
|
3593
3629
|
else if (since !== undefined) {
|
|
3594
3630
|
throw new errors.ArgumentsRequired(this.id + ' fetchTrades() requires a `until` parameter when you use `since` argument');
|
|
3595
3631
|
}
|
|
3596
|
-
|
|
3632
|
+
let response = undefined;
|
|
3633
|
+
let usePrivate = false;
|
|
3634
|
+
[usePrivate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'usePrivate', false);
|
|
3635
|
+
if (usePrivate) {
|
|
3636
|
+
response = await this.v3PrivateGetBrokerageProductsProductIdTicker(this.extend(request, params));
|
|
3637
|
+
}
|
|
3638
|
+
else {
|
|
3639
|
+
response = await this.v3PublicGetBrokerageMarketProductsProductIdTicker(this.extend(request, params));
|
|
3640
|
+
}
|
|
3597
3641
|
//
|
|
3598
3642
|
// {
|
|
3599
3643
|
// "trades": [
|
|
@@ -3694,6 +3738,7 @@ class coinbase extends coinbase$1 {
|
|
|
3694
3738
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
3695
3739
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
3696
3740
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3741
|
+
* @param {boolean} [params.usePrivate] default false, when true will use the private endpoint to fetch the order book
|
|
3697
3742
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
3698
3743
|
*/
|
|
3699
3744
|
await this.loadMarkets();
|
|
@@ -3704,7 +3749,15 @@ class coinbase extends coinbase$1 {
|
|
|
3704
3749
|
if (limit !== undefined) {
|
|
3705
3750
|
request['limit'] = limit;
|
|
3706
3751
|
}
|
|
3707
|
-
|
|
3752
|
+
let response = undefined;
|
|
3753
|
+
let usePrivate = false;
|
|
3754
|
+
[usePrivate, params] = this.handleOptionAndParams(params, 'fetchOrderBook', 'usePrivate', false);
|
|
3755
|
+
if (usePrivate) {
|
|
3756
|
+
response = await this.v3PrivateGetBrokerageProductBook(this.extend(request, params));
|
|
3757
|
+
}
|
|
3758
|
+
else {
|
|
3759
|
+
response = await this.v3PublicGetBrokerageMarketProductBook(this.extend(request, params));
|
|
3760
|
+
}
|
|
3708
3761
|
//
|
|
3709
3762
|
// {
|
|
3710
3763
|
// "pricebook": {
|
|
@@ -4484,6 +4537,67 @@ class coinbase extends coinbase$1 {
|
|
|
4484
4537
|
'takeProfitPrice': undefined,
|
|
4485
4538
|
});
|
|
4486
4539
|
}
|
|
4540
|
+
async fetchTradingFees(params = {}) {
|
|
4541
|
+
/**
|
|
4542
|
+
* @method
|
|
4543
|
+
* @name coinbase#fetchTradingFees
|
|
4544
|
+
* @see https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_gettransactionsummary/
|
|
4545
|
+
* @description fetch the trading fees for multiple markets
|
|
4546
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4547
|
+
* @param {string} [params.type] 'spot' or 'swap'
|
|
4548
|
+
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
4549
|
+
*/
|
|
4550
|
+
await this.loadMarkets();
|
|
4551
|
+
let type = undefined;
|
|
4552
|
+
[type, params] = this.handleMarketTypeAndParams('fetchTradingFees', undefined, params);
|
|
4553
|
+
const isSpot = (type === 'spot');
|
|
4554
|
+
const productType = isSpot ? 'SPOT' : 'FUTURE';
|
|
4555
|
+
const request = {
|
|
4556
|
+
'product_type': productType,
|
|
4557
|
+
};
|
|
4558
|
+
const response = await this.v3PrivateGetBrokerageTransactionSummary(this.extend(request, params));
|
|
4559
|
+
//
|
|
4560
|
+
// {
|
|
4561
|
+
// total_volume: '0',
|
|
4562
|
+
// total_fees: '0',
|
|
4563
|
+
// fee_tier: {
|
|
4564
|
+
// pricing_tier: 'Advanced 1',
|
|
4565
|
+
// usd_from: '0',
|
|
4566
|
+
// usd_to: '1000',
|
|
4567
|
+
// taker_fee_rate: '0.008',
|
|
4568
|
+
// maker_fee_rate: '0.006',
|
|
4569
|
+
// aop_from: '',
|
|
4570
|
+
// aop_to: ''
|
|
4571
|
+
// },
|
|
4572
|
+
// margin_rate: null,
|
|
4573
|
+
// goods_and_services_tax: null,
|
|
4574
|
+
// advanced_trade_only_volume: '0',
|
|
4575
|
+
// advanced_trade_only_fees: '0',
|
|
4576
|
+
// coinbase_pro_volume: '0',
|
|
4577
|
+
// coinbase_pro_fees: '0',
|
|
4578
|
+
// total_balance: '',
|
|
4579
|
+
// has_promo_fee: false
|
|
4580
|
+
// }
|
|
4581
|
+
//
|
|
4582
|
+
const data = this.safeDict(response, 'fee_tier', {});
|
|
4583
|
+
const taker_fee = this.safeNumber(data, 'taker_fee_rate');
|
|
4584
|
+
const marker_fee = this.safeNumber(data, 'maker_fee_rate');
|
|
4585
|
+
const result = {};
|
|
4586
|
+
for (let i = 0; i < this.symbols.length; i++) {
|
|
4587
|
+
const symbol = this.symbols[i];
|
|
4588
|
+
const market = this.market(symbol);
|
|
4589
|
+
if ((isSpot && market['spot']) || (!isSpot && !market['spot'])) {
|
|
4590
|
+
result[symbol] = {
|
|
4591
|
+
'info': response,
|
|
4592
|
+
'symbol': symbol,
|
|
4593
|
+
'maker': taker_fee,
|
|
4594
|
+
'taker': marker_fee,
|
|
4595
|
+
'percentage': true,
|
|
4596
|
+
};
|
|
4597
|
+
}
|
|
4598
|
+
}
|
|
4599
|
+
return result;
|
|
4600
|
+
}
|
|
4487
4601
|
createAuthToken(seconds, method = undefined, url = undefined) {
|
|
4488
4602
|
// it may not work for v2
|
|
4489
4603
|
let uri = undefined;
|
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -4643,7 +4643,7 @@ class coinex extends coinex$1 {
|
|
|
4643
4643
|
* @method
|
|
4644
4644
|
* @name coinex#withdraw
|
|
4645
4645
|
* @description make a withdrawal
|
|
4646
|
-
* @see https://
|
|
4646
|
+
* @see https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/withdrawal
|
|
4647
4647
|
* @param {string} code unified currency code
|
|
4648
4648
|
* @param {float} amount the amount to withdraw
|
|
4649
4649
|
* @param {string} address the address to withdraw to
|
|
@@ -4656,37 +4656,44 @@ class coinex extends coinex$1 {
|
|
|
4656
4656
|
this.checkAddress(address);
|
|
4657
4657
|
await this.loadMarkets();
|
|
4658
4658
|
const currency = this.currency(code);
|
|
4659
|
-
const networkCode = this.
|
|
4659
|
+
const networkCode = this.safeStringUpper2(params, 'network', 'chain');
|
|
4660
4660
|
params = this.omit(params, 'network');
|
|
4661
4661
|
if (tag) {
|
|
4662
4662
|
address = address + ':' + tag;
|
|
4663
4663
|
}
|
|
4664
4664
|
const request = {
|
|
4665
|
-
'
|
|
4666
|
-
'
|
|
4667
|
-
'
|
|
4668
|
-
'transfer_method': 'onchain', // onchain, local
|
|
4665
|
+
'ccy': currency['id'],
|
|
4666
|
+
'to_address': address,
|
|
4667
|
+
'amount': this.numberToString(amount), // the actual amount without fees, https://www.coinex.com/fees
|
|
4669
4668
|
};
|
|
4670
4669
|
if (networkCode !== undefined) {
|
|
4671
|
-
request['
|
|
4670
|
+
request['chain'] = this.networkCodeToId(networkCode); // required for on-chain, not required for inter-user transfer
|
|
4672
4671
|
}
|
|
4673
|
-
const response = await this.
|
|
4672
|
+
const response = await this.v2PrivatePostAssetsWithdraw(this.extend(request, params));
|
|
4674
4673
|
//
|
|
4675
4674
|
// {
|
|
4676
4675
|
// "code": 0,
|
|
4677
4676
|
// "data": {
|
|
4678
|
-
// "
|
|
4679
|
-
// "
|
|
4680
|
-
// "
|
|
4681
|
-
// "
|
|
4682
|
-
// "
|
|
4677
|
+
// "withdraw_id": 31193755,
|
|
4678
|
+
// "created_at": 1716874165038,
|
|
4679
|
+
// "withdraw_method": "ON_CHAIN",
|
|
4680
|
+
// "ccy": "USDT",
|
|
4681
|
+
// "amount": "17.3",
|
|
4682
|
+
// "actual_amount": "15",
|
|
4683
|
+
// "chain": "TRC20",
|
|
4684
|
+
// "tx_fee": "2.3",
|
|
4685
|
+
// "fee_asset": "USDT",
|
|
4686
|
+
// "fee_amount": "2.3",
|
|
4687
|
+
// "to_address": "TY5vq3MT6b5cQVAHWHtpGyPg1ERcQgi3UN",
|
|
4688
|
+
// "memo": "",
|
|
4689
|
+
// "tx_id": "",
|
|
4683
4690
|
// "confirmations": 0,
|
|
4684
|
-
// "
|
|
4685
|
-
// "
|
|
4686
|
-
// "
|
|
4687
|
-
// "
|
|
4691
|
+
// "explorer_address_url": "https://tronscan.org/#/address/TY5vq3MT6b5cQVAHWHtpGyPg1ERcQgi3UN",
|
|
4692
|
+
// "explorer_tx_url": "https://tronscan.org/#/transaction/",
|
|
4693
|
+
// "remark": "",
|
|
4694
|
+
// "status": "audit_required"
|
|
4688
4695
|
// },
|
|
4689
|
-
// "message": "
|
|
4696
|
+
// "message": "OK"
|
|
4690
4697
|
// }
|
|
4691
4698
|
//
|
|
4692
4699
|
const transaction = this.safeDict(response, 'data', {});
|
|
@@ -4797,7 +4804,7 @@ class coinex extends coinex$1 {
|
|
|
4797
4804
|
// "remark": ""
|
|
4798
4805
|
// }
|
|
4799
4806
|
//
|
|
4800
|
-
// fetchWithdrawals
|
|
4807
|
+
// fetchWithdrawals and withdraw
|
|
4801
4808
|
//
|
|
4802
4809
|
// {
|
|
4803
4810
|
// "withdraw_id": 259364,
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -986,7 +986,9 @@ class kraken extends kraken$1 {
|
|
|
986
986
|
request['interval'] = timeframe;
|
|
987
987
|
}
|
|
988
988
|
if (since !== undefined) {
|
|
989
|
-
|
|
989
|
+
const scaledSince = this.parseToInt(since / 1000);
|
|
990
|
+
const timeFrameInSeconds = parsedTimeframe * 60;
|
|
991
|
+
request['since'] = this.numberToString(scaledSince - timeFrameInSeconds); // expected to be in seconds
|
|
990
992
|
}
|
|
991
993
|
const response = await this.publicGetOHLC(this.extend(request, params));
|
|
992
994
|
//
|