ccxt 4.2.73 → 4.2.75
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/CHANGELOG.md +206 -10
- package/README.md +10 -9
- package/build.sh +1 -1
- package/dist/ccxt.browser.js +1042 -297
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +4 -1
- package/dist/cjs/src/abstract/tradeogre.js +9 -0
- package/dist/cjs/src/ascendex.js +3 -2
- package/dist/cjs/src/base/Exchange.js +1 -1
- package/dist/cjs/src/bitget.js +62 -50
- package/dist/cjs/src/bitmart.js +1 -0
- package/dist/cjs/src/bybit.js +90 -30
- package/dist/cjs/src/coinbaseinternational.js +1 -1
- package/dist/cjs/src/coinex.js +4 -3
- package/dist/cjs/src/gate.js +1 -0
- package/dist/cjs/src/htx.js +16 -9
- package/dist/cjs/src/hyperliquid.js +2 -1
- package/dist/cjs/src/kraken.js +3 -3
- package/dist/cjs/src/kucoin.js +1 -1
- package/dist/cjs/src/pro/krakenfutures.js +8 -7
- package/dist/cjs/src/tradeogre.js +632 -0
- package/examples/README.md +308 -0
- package/examples/ccxt.pro/html/watchTicker.html +51 -0
- package/examples/ccxt.pro/js/binance-fetch-balance-snapshot-watch-balance-updates.js +55 -0
- package/examples/ccxt.pro/js/binance-https-proxy.js +48 -0
- package/examples/ccxt.pro/js/binance-watch-ohlcv-many-symbols-continuously.js +38 -0
- package/examples/ccxt.pro/js/binance-watch-ohlcv-many-symbols.js +64 -0
- package/examples/ccxt.pro/js/binance-watch-ticker-many-symbols.js +62 -0
- package/examples/ccxt.pro/js/build-ohlcv-many-symbols.js +68 -0
- package/examples/ccxt.pro/js/calculate-ohlcvs-from-trades-warmup.js +82 -0
- package/examples/ccxt.pro/js/calculate-ohlcvs-from-trades.js +59 -0
- package/examples/ccxt.pro/js/exchange-capabitities.js +72 -0
- package/examples/ccxt.pro/js/exchange-close.js +46 -0
- package/examples/ccxt.pro/js/gateio-swap-watch-many-orderbooks.js +30 -0
- package/examples/ccxt.pro/js/gateio-watch-balance.js +23 -0
- package/examples/ccxt.pro/js/gateio-watch-order-book.js +71 -0
- package/examples/ccxt.pro/js/graceful-shutdown.js +43 -0
- package/examples/ccxt.pro/js/many-exchanges-many-streams.js +37 -0
- package/examples/ccxt.pro/js/okex-create-futures-order.js +48 -0
- package/examples/ccxt.pro/js/okex-watch-balance-and-create-order.js +54 -0
- package/examples/ccxt.pro/js/okx-watch-tickers.js +31 -0
- package/examples/ccxt.pro/js/one-exchange-many-different-streams.js +46 -0
- package/examples/ccxt.pro/js/one-exchange-many-streams-2.js +26 -0
- package/examples/ccxt.pro/js/one-exchange-many-streams.js +28 -0
- package/examples/ccxt.pro/js/socks-binance-watch-orderbook.js +30 -0
- package/examples/ccxt.pro/js/watch-fetch-many-exchanges-many-ordersbooks.js +40 -0
- package/examples/ccxt.pro/js/watch-many-exchanges-many-ordersbooks.js +38 -0
- package/examples/ccxt.pro/js/watch-many-exchanges-many-symbols.js +40 -0
- package/examples/ccxt.pro/js/watch-many-orderbooks.js +27 -0
- package/examples/ccxt.pro/js/watch-new-trades-only.js +43 -0
- package/examples/ccxt.pro/js/watch-new-trades.js +42 -0
- package/examples/ccxt.pro/js/watch-trades-many-symbols.js +29 -0
- package/examples/ccxt.pro/js/watch-vs-fetch.js +29 -0
- package/examples/cs/Examples.sln +22 -0
- package/examples/cs/c#.csproj +19 -0
- package/examples/html/basic-cors-proxy.html +46 -0
- package/examples/html/basic-inheritance.html +47 -0
- package/examples/html/basic-poller.html +52 -0
- package/examples/html/basic-rate-limiting.html +49 -0
- package/examples/html/basic.html +43 -0
- package/examples/html/binance-cors-proxy.html +28 -0
- package/examples/html/bitmex-browser-cors-proxy.js +7 -0
- package/examples/html/bitmex-cors.html +46 -0
- package/examples/html/tradingview-charts.html +61 -0
- package/examples/html/webworker/index.html +97 -0
- package/examples/html/webworker/worker.js +43 -0
- package/examples/js/README.md +15 -0
- package/examples/js/advanced-error-handling.js +39 -0
- package/examples/js/aggregate-orderbook.js +54 -0
- package/examples/js/arbitrage-pairs.js +130 -0
- package/examples/js/basic-chart.js +29 -0
- package/examples/js/basic-orderbook-polling.js +13 -0
- package/examples/js/bcc-vs-bch.js +115 -0
- package/examples/js/binance-fetch-all-deposits.js +45 -0
- package/examples/js/binance-fetch-ohlcv-many-symbols-async-await.js +34 -0
- package/examples/js/binance-fetch-ohlcv-many-symbols-promise-then-callbacks.js +33 -0
- package/examples/js/binance-fetchTicker-delivery-vs-future.js +31 -0
- package/examples/js/binance-futures-transfer-from-sub-account-to-master.js +41 -0
- package/examples/js/binance-margin-stop-order.js +39 -0
- package/examples/js/binance-server-time.js +34 -0
- package/examples/js/binance-universal-transfer.js +16 -0
- package/examples/js/bitfinex-fetch-trades.js +35 -0
- package/examples/js/bitfinex2-fetch-trades.js +35 -0
- package/examples/js/bitmex-browser-cors-proxy.js +7 -0
- package/examples/js/bitpanda-fetchMyTrades-reduce.js +36 -0
- package/examples/js/bitrue-fetch-balance.js +28 -0
- package/examples/js/bitstamp-private-api.js +115 -0
- package/examples/js/bitstamp-public-api.js +39 -0
- package/examples/js/bittrex-balance.js +50 -0
- package/examples/js/bittrex-fetch-closed-orders-history.js +69 -0
- package/examples/js/blockchaincom-withdrawal.js +59 -0
- package/examples/js/build-ohlcv-bars.js +48 -0
- package/examples/js/builtin-rate-limiting-rest-poller.js +25 -0
- package/examples/js/bybit-trailing.js +62 -0
- package/examples/js/bybit-updated.cjs +154 -0
- package/examples/js/cli.js +405 -0
- package/examples/js/coinbase-fetch-all-balances.js +36 -0
- package/examples/js/coinex-fetch-all-deposit-addresses-using-fetchDepositAddress.js +47 -0
- package/examples/js/coinex-futures.js +75 -0
- package/examples/js/coinone-fetch-tickers.js +54 -0
- package/examples/js/coinone-markets.js +16 -0
- package/examples/js/compare-two-exchanges-capabilities.js +36 -0
- package/examples/js/cors-proxy.js +5 -0
- package/examples/js/create-order-handle-errors.js +55 -0
- package/examples/js/create-order-position-with-takeprofit-stoploss.js +71 -0
- package/examples/js/create-order-with-retry.js +65 -0
- package/examples/js/create-order-ws-example.js +25 -0
- package/examples/js/create-orders-example.js +17 -0
- package/examples/js/create-trailing-amount-order.js +36 -0
- package/examples/js/create-trailing-percent-order.js +36 -0
- package/examples/js/credentials.json +5 -0
- package/examples/js/custom-proxy-agent-for-js.js +10 -0
- package/examples/js/custom-proxy-url.js +23 -0
- package/examples/js/delta-maintenance-margin-rate-max-leverage.js +60 -0
- package/examples/js/env-variables.js +26 -0
- package/examples/js/error-handling.js +89 -0
- package/examples/js/exchange-capabilities.js +135 -0
- package/examples/js/exchanges-by-volume.js +60 -0
- package/examples/js/exchanges.js +40 -0
- package/examples/js/fetch-all-balances.js +219 -0
- package/examples/js/fetch-all-tickers-to-files-2.js +53 -0
- package/examples/js/fetch-all-tickers-to-files.js +77 -0
- package/examples/js/fetch-balance.js +28 -0
- package/examples/js/fetch-create-deposit-address.js +101 -0
- package/examples/js/fetch-from-many-exchanges-simultaneously.js +21 -0
- package/examples/js/fetch-funding-rate-history.js +25 -0
- package/examples/js/fetch-futures/prettier.config.js +5 -0
- package/examples/js/fetch-futures/src/index.js +25 -0
- package/examples/js/fetch-ohlcv-from-to-mark-index-premium.js +72 -0
- package/examples/js/fetch-ohlcv-many-exchanges-continuosly.js +39 -0
- package/examples/js/fetch-ohlcv.js +16 -0
- package/examples/js/fetch-okex-futures.js +22 -0
- package/examples/js/fetch-orders.js +27 -0
- package/examples/js/fetch-ticker-from-multiple-exchanges.js +35 -0
- package/examples/js/fetch-ticker-where-available.js +75 -0
- package/examples/js/fetch-tickers/build/index.js +19 -0
- package/examples/js/fetch-tickers/prettier.config.js +5 -0
- package/examples/js/fetch-tickers/src/index.js +17 -0
- package/examples/js/gateio-create-batch-order.js +43 -0
- package/examples/js/gateio-futures.js +49 -0
- package/examples/js/gateio-open-close-contract.js +49 -0
- package/examples/js/gateio-swaps.js +74 -0
- package/examples/js/gdax-fetch-trades-pagination.js +29 -0
- package/examples/js/hitbtc2-withdraw.js +61 -0
- package/examples/js/how-to-import-one-exchange-esm.js +10 -0
- package/examples/js/huobi-futures.js +71 -0
- package/examples/js/huobi-open-close-contract.js +63 -0
- package/examples/js/huobi-swaps.js +70 -0
- package/examples/js/huobipro-market-buy-sell-fetch-trading-limits.js +98 -0
- package/examples/js/hybridCJSExample.cjs +19 -0
- package/examples/js/hybridESMExample.js +19 -0
- package/examples/js/idex-fetch-balance.js +13 -0
- package/examples/js/instantiate-all-at-once.js +46 -0
- package/examples/js/instantiate-all-from-json.js +31 -0
- package/examples/js/kraken-create-and-close-position.js +54 -0
- package/examples/js/kraken-fetch-order-trades.js +33 -0
- package/examples/js/kraken-margin-trading.js +89 -0
- package/examples/js/kucoin-rate-limit.js +38 -0
- package/examples/js/latoken-example.js +108 -0
- package/examples/js/live-orderbook.js +106 -0
- package/examples/js/live-ticker.js +80 -0
- package/examples/js/live-tickers.js +74 -0
- package/examples/js/load-all-contracts.js +41 -0
- package/examples/js/load-all-symbols-at-once.js +69 -0
- package/examples/js/load-all-tickers-at-once.js +91 -0
- package/examples/js/load-markets-to-files.js +57 -0
- package/examples/js/looping-over-all-symbols-of-specific-exchanges.js +61 -0
- package/examples/js/looping-over-specific-symbols-of-all-exchanges.js +91 -0
- package/examples/js/margin-loan-borrow-buy-sell-repay.js +70 -0
- package/examples/js/market-status-and-currency-status.js +29 -0
- package/examples/js/ohlcv-console-chart.js +29 -0
- package/examples/js/okex-fetch-closed-orders-archive.js +31 -0
- package/examples/js/okex-transfer.js +51 -0
- package/examples/js/okx-poll-fetch-my-trades.js +37 -0
- package/examples/js/okx-poll-rate-limit.js +48 -0
- package/examples/js/order-book-extra-level-depth-param.js +20 -0
- package/examples/js/phemex-create-order-position-with-takeprofit-stoploss.js +49 -0
- package/examples/js/poll-ohlcv.js +43 -0
- package/examples/js/poloniex-fetch-order-books.js +35 -0
- package/examples/js/poloniex-limits-amount-min.js +62 -0
- package/examples/js/proxy-round-robin.js +98 -0
- package/examples/js/proxy-usage.js +32 -0
- package/examples/js/sample-local-proxy-server-with-cors.js +12 -0
- package/examples/js/search-all-exchanges.js +159 -0
- package/examples/js/shared-load-markets.js +80 -0
- package/examples/js/sort-swap-markets-by-hourly-price-change.js +55 -0
- package/examples/js/symbols.js +110 -0
- package/examples/js/theocean.js +41 -0
- package/examples/js/tickers.js +106 -0
- package/examples/js/validate-paginated-data.js +61 -0
- package/examples/js/watch-OHLCV-For-Symbols.js +15 -0
- package/examples/js/watch-OHLCV.js +12 -0
- package/examples/js/watch-OrderBook-For-Symbols.js +11 -0
- package/examples/js/watch-Trades-For-Symbols.js +11 -0
- package/examples/js/watch-tickers.js +11 -0
- package/examples/js/watchOHLCVForSymbols.js +15 -0
- package/examples/js/watchOrderBookForSymbols.js +11 -0
- package/examples/js/watchPositions-many-exchanges-continuosly.d.ts +2 -0
- package/examples/js/watchPositions-many-exchanges-continuosly.d.ts.map +1 -0
- package/examples/js/watchPositions-many-exchanges-continuosly.js +49 -0
- package/examples/js/watchPositions.d.ts +2 -0
- package/examples/js/watchPositions.d.ts.map +1 -0
- package/examples/js/watchPositions.js +13 -0
- package/examples/js/watchPositionsForSymbols.d.ts +2 -0
- package/examples/js/watchPositionsForSymbols.d.ts.map +1 -0
- package/examples/js/watchPositionsForSymbols.js +14 -0
- package/examples/js/watchTradesForSymbols.js +11 -0
- package/examples/js/withdraw-from-one-exchange-to-another.js +50 -0
- package/examples/php/README.md +7 -0
- package/examples/py/README.md +15 -0
- package/examples/py/playing_with_ccxt_example.ipynb +222 -0
- package/examples/ts/.eslintrc +111 -0
- package/examples/ts/build-ohlcv-bars.ts +53 -0
- package/examples/ts/cli.ts +397 -0
- package/examples/ts/compare-two-exchanges-capabilities.ts +36 -0
- package/examples/ts/create-order-position-with-takeprofit-stoploss.ts +89 -0
- package/examples/ts/create-order-ws-example.ts +33 -0
- package/examples/ts/create-orders-example.ts +21 -0
- package/examples/ts/create-trailing-amount-order.ts +37 -0
- package/examples/ts/create-trailing-percent-order.ts +37 -0
- package/examples/ts/custom-proxy-agent-for-js.ts +14 -0
- package/examples/ts/fetch-futures/package-lock.json +116 -0
- package/examples/ts/fetch-futures/package.json +34 -0
- package/examples/ts/fetch-futures/prettier.config.js +4 -0
- package/examples/ts/fetch-futures/src/index.ts +28 -0
- package/examples/ts/fetch-futures/tsconfig.json +28 -0
- package/examples/ts/fetch-ohlcv-many-exchanges-continuosly.ts +44 -0
- package/examples/ts/fetch-ohlcv.ts +17 -0
- package/examples/ts/fetch-tickers/package-lock.json +116 -0
- package/examples/ts/fetch-tickers/package.json +34 -0
- package/examples/ts/fetch-tickers/prettier.config.js +4 -0
- package/examples/ts/fetch-tickers/src/index.ts +21 -0
- package/examples/ts/fetch-tickers/tsconfig.json +28 -0
- package/examples/ts/how-to-import-one-exchange-esm.ts +11 -0
- package/examples/ts/kraken-create-and-close-position.ts +69 -0
- package/examples/ts/margin-loan-borrow-buy-sell-repay.ts +72 -0
- package/examples/ts/nextjs-page-router/.eslintrc.json +3 -0
- package/examples/ts/nextjs-page-router/README.md +43 -0
- package/examples/ts/nextjs-page-router/next.config.js +6 -0
- package/examples/ts/nextjs-page-router/package-lock.json +7425 -0
- package/examples/ts/nextjs-page-router/package.json +28 -0
- package/examples/ts/nextjs-page-router/postcss.config.js +6 -0
- package/examples/ts/nextjs-page-router/public/favicon.ico +0 -0
- package/examples/ts/nextjs-page-router/src/pages/_app.tsx +6 -0
- package/examples/ts/nextjs-page-router/src/pages/_document.tsx +13 -0
- package/examples/ts/nextjs-page-router/src/pages/balance.tsx +46 -0
- package/examples/ts/nextjs-page-router/src/pages/index.tsx +8 -0
- package/examples/ts/nextjs-page-router/src/pages/tickers.tsx +61 -0
- package/examples/ts/nextjs-page-router/src/styles/globals.css +27 -0
- package/examples/ts/nextjs-page-router/tailwind.config.ts +20 -0
- package/examples/ts/nextjs-page-router/tsconfig.json +22 -0
- package/examples/ts/phemex-create-order-position-with-takeprofit-stoploss.ts +62 -0
- package/examples/ts/proxy-usage.ts +41 -0
- package/examples/ts/sample-local-proxy-server-with-cors.ts +15 -0
- package/examples/ts/watch-OHLCV-For-Symbols.ts +17 -0
- package/examples/ts/watch-OHLCV.ts +14 -0
- package/examples/ts/watch-OrderBook-For-Symbols.ts +13 -0
- package/examples/ts/watch-Trades-For-Symbols.ts +13 -0
- package/examples/ts/watch-tickers.ts +13 -0
- package/examples/ts/watchPositions-many-exchanges-continuosly.ts +53 -0
- package/examples/ts/watchPositions.ts +15 -0
- package/examples/ts/watchPositionsForSymbols.ts +16 -0
- package/examples/tsconfig.json +27 -0
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- package/js/src/abstract/tradeogre.d.ts +19 -0
- package/js/src/abstract/tradeogre.js +11 -0
- package/js/src/ascendex.d.ts +2 -7
- package/js/src/ascendex.js +3 -2
- package/js/src/base/Exchange.d.ts +7 -7
- package/js/src/base/Exchange.js +1 -1
- package/js/src/base/types.d.ts +7 -1
- package/js/src/binance.d.ts +1 -1
- package/js/src/bitget.js +62 -50
- package/js/src/bitmart.d.ts +1 -1
- package/js/src/bitmart.js +2 -1
- package/js/src/bybit.d.ts +3 -1
- package/js/src/bybit.js +90 -30
- package/js/src/coinbase.d.ts +4 -4
- package/js/src/coinbaseinternational.d.ts +1 -1
- package/js/src/coinbaseinternational.js +1 -1
- package/js/src/coinbasepro.d.ts +2 -2
- package/js/src/coinex.js +4 -3
- package/js/src/coinlist.d.ts +2 -2
- package/js/src/cryptocom.d.ts +2 -2
- package/js/src/currencycom.d.ts +2 -2
- package/js/src/deribit.d.ts +2 -2
- package/js/src/gate.d.ts +1 -1
- package/js/src/gate.js +1 -0
- package/js/src/htx.d.ts +2 -2
- package/js/src/htx.js +16 -9
- package/js/src/huobijp.d.ts +2 -2
- package/js/src/hyperliquid.js +2 -1
- package/js/src/kraken.d.ts +1 -1
- package/js/src/kraken.js +3 -3
- package/js/src/kucoin.d.ts +3 -3
- package/js/src/kucoin.js +1 -1
- package/js/src/luno.d.ts +2 -2
- package/js/src/mexc.d.ts +3 -3
- package/js/src/ndax.d.ts +2 -2
- package/js/src/novadax.d.ts +2 -2
- package/js/src/okx.d.ts +2 -2
- package/js/src/pro/bitfinex2.d.ts +1 -1
- package/js/src/pro/krakenfutures.js +8 -7
- package/js/src/tradeogre.d.ts +32 -0
- package/js/src/tradeogre.js +633 -0
- package/js/src/woo.d.ts +2 -2
- package/package.json +4 -1
- package/skip-tests.json +219 -424
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { implicitReturnType } from '../base/types.js';
|
|
2
|
+
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
3
|
+
interface Exchange {
|
|
4
|
+
publicGetMarkets(params?: {}): Promise<implicitReturnType>;
|
|
5
|
+
publicGetOrdersMarket(params?: {}): Promise<implicitReturnType>;
|
|
6
|
+
publicGetTickerMarket(params?: {}): Promise<implicitReturnType>;
|
|
7
|
+
publicGetHistoryMarket(params?: {}): Promise<implicitReturnType>;
|
|
8
|
+
privateGetAccountBalance(params?: {}): Promise<implicitReturnType>;
|
|
9
|
+
privateGetAccountBalances(params?: {}): Promise<implicitReturnType>;
|
|
10
|
+
privateGetAccountOrderUuid(params?: {}): Promise<implicitReturnType>;
|
|
11
|
+
privatePostOrderBuy(params?: {}): Promise<implicitReturnType>;
|
|
12
|
+
privatePostOrderSell(params?: {}): Promise<implicitReturnType>;
|
|
13
|
+
privatePostOrderCancel(params?: {}): Promise<implicitReturnType>;
|
|
14
|
+
privatePostOrders(params?: {}): Promise<implicitReturnType>;
|
|
15
|
+
privatePostAccountOrders(params?: {}): Promise<implicitReturnType>;
|
|
16
|
+
}
|
|
17
|
+
declare abstract class Exchange extends _Exchange {
|
|
18
|
+
}
|
|
19
|
+
export default Exchange;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// ----------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
|
4
|
+
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
|
5
|
+
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
|
6
|
+
|
|
7
|
+
// -------------------------------------------------------------------------------
|
|
8
|
+
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
9
|
+
class Exchange extends _Exchange {
|
|
10
|
+
}
|
|
11
|
+
export default Exchange;
|
package/js/src/ascendex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/ascendex.js';
|
|
2
|
-
import type { TransferEntry, FundingHistory, Int, OHLCV, Order, OrderSide, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Strings, Num, Currency, Market, Leverage, Leverages, MarginModes, MarginMode } from './base/types.js';
|
|
2
|
+
import type { TransferEntry, FundingHistory, Int, OHLCV, Order, OrderSide, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Strings, Num, Currency, Market, Leverage, Leverages, Account, MarginModes, MarginMode } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class ascendex
|
|
5
5
|
* @augments Exchange
|
|
@@ -10,12 +10,7 @@ export default class ascendex extends Exchange {
|
|
|
10
10
|
fetchCurrencies(params?: {}): Promise<{}>;
|
|
11
11
|
fetchMarkets(params?: {}): Promise<any[]>;
|
|
12
12
|
fetchTime(params?: {}): Promise<number>;
|
|
13
|
-
fetchAccounts(params?: {}): Promise<
|
|
14
|
-
id: string;
|
|
15
|
-
type: any;
|
|
16
|
-
currency: any;
|
|
17
|
-
info: any;
|
|
18
|
-
}[]>;
|
|
13
|
+
fetchAccounts(params?: {}): Promise<Account[]>;
|
|
19
14
|
parseBalance(response: any): Balances;
|
|
20
15
|
parseMarginBalance(response: any): Balances;
|
|
21
16
|
parseSwapBalance(response: any): Balances;
|
package/js/src/ascendex.js
CHANGED
|
@@ -753,7 +753,7 @@ export default class ascendex extends Exchange {
|
|
|
753
753
|
{
|
|
754
754
|
'id': accountGroup,
|
|
755
755
|
'type': undefined,
|
|
756
|
-
'
|
|
756
|
+
'code': undefined,
|
|
757
757
|
'info': response,
|
|
758
758
|
},
|
|
759
759
|
];
|
|
@@ -2733,7 +2733,8 @@ export default class ascendex extends Exchange {
|
|
|
2733
2733
|
if (Precise.stringEq(notional, '0')) {
|
|
2734
2734
|
notional = this.safeString(position, 'sellOpenOrderNotional');
|
|
2735
2735
|
}
|
|
2736
|
-
const
|
|
2736
|
+
const marginType = this.safeString(position, 'marginType');
|
|
2737
|
+
const marginMode = (marginType === 'crossed') ? 'cross' : 'isolated';
|
|
2737
2738
|
let collateral = undefined;
|
|
2738
2739
|
if (marginMode === 'isolated') {
|
|
2739
2740
|
collateral = this.safeString(position, 'isolatedMargin');
|
|
@@ -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, Str, Num, MarketInterface, CurrencyInterface,
|
|
7
|
-
export type { Market, Trade, Fee, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRateHistory, Liquidation, FundingHistory, Greeks, Leverage, Leverages } 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, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account } 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, FundingRateHistory, Liquidation, FundingHistory, Greeks, Leverage, Leverages, Str } from './types.js';
|
|
8
8
|
import { ArrayCache, ArrayCacheByTimestamp } from './ws/Cache.js';
|
|
9
9
|
import { OrderBook as Ob } from './ws/OrderBook.js';
|
|
10
10
|
/**
|
|
@@ -111,7 +111,7 @@ export default class Exchange {
|
|
|
111
111
|
last_request_body: any;
|
|
112
112
|
last_request_url: any;
|
|
113
113
|
last_request_path: any;
|
|
114
|
-
id:
|
|
114
|
+
id: string;
|
|
115
115
|
markets: Dictionary<any>;
|
|
116
116
|
has: Dictionary<boolean | 'emulated'>;
|
|
117
117
|
status: any;
|
|
@@ -644,7 +644,7 @@ export default class Exchange {
|
|
|
644
644
|
filterByValueSinceLimit(array: object[], field: IndexType, value?: any, since?: Int, limit?: Int, key?: string, tail?: boolean): any;
|
|
645
645
|
setSandboxMode(enabled: boolean): void;
|
|
646
646
|
sign(path: any, api?: any, method?: string, params?: {}, headers?: any, body?: any): {};
|
|
647
|
-
fetchAccounts(params?: {}): Promise<
|
|
647
|
+
fetchAccounts(params?: {}): Promise<Account[]>;
|
|
648
648
|
fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
649
649
|
fetchTradesWs(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
650
650
|
watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
@@ -668,7 +668,7 @@ export default class Exchange {
|
|
|
668
668
|
parseTrade(trade: object, market?: Market): Trade;
|
|
669
669
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
|
670
670
|
parseTransfer(transfer: any, currency?: Currency): object;
|
|
671
|
-
parseAccount(account: any):
|
|
671
|
+
parseAccount(account: any): Account;
|
|
672
672
|
parseLedgerEntry(item: any, currency?: Currency): object;
|
|
673
673
|
parseOrder(order: any, market?: Market): Order;
|
|
674
674
|
fetchCrossBorrowRates(params?: {}): Promise<{}>;
|
|
@@ -789,7 +789,7 @@ export default class Exchange {
|
|
|
789
789
|
loadTradingLimits(symbols?: string[], reload?: boolean, params?: {}): Promise<Dictionary<any>>;
|
|
790
790
|
safePosition(position: any): Position;
|
|
791
791
|
parsePositions(positions: any[], symbols?: string[], params?: {}): Position[];
|
|
792
|
-
parseAccounts(accounts: any[], params?: {}):
|
|
792
|
+
parseAccounts(accounts: any[], params?: {}): Account[];
|
|
793
793
|
parseTrades(trades: any[], market?: Market, since?: Int, limit?: Int, params?: {}): Trade[];
|
|
794
794
|
parseTransactions(transactions: any[], currency?: Currency, since?: Int, limit?: Int, params?: {}): Transaction[];
|
|
795
795
|
parseTransfers(transfers: any[], currency?: Currency, since?: Int, limit?: Int, params?: {}): any;
|
|
@@ -914,7 +914,7 @@ export default class Exchange {
|
|
|
914
914
|
fetchL3OrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
915
915
|
parseLastPrice(price: any, market?: Market): LastPrice;
|
|
916
916
|
fetchDepositAddress(code: string, params?: {}): Promise<any>;
|
|
917
|
-
account():
|
|
917
|
+
account(): BalanceAccount;
|
|
918
918
|
commonCurrencyCode(currency: string): string;
|
|
919
919
|
currency(code: string): any;
|
|
920
920
|
market(symbol: string): MarketInterface;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -77,7 +77,7 @@ export default class Exchange {
|
|
|
77
77
|
this.last_request_body = undefined;
|
|
78
78
|
this.last_request_url = undefined;
|
|
79
79
|
this.last_request_path = undefined;
|
|
80
|
-
this.id =
|
|
80
|
+
this.id = 'Exchange';
|
|
81
81
|
this.markets = undefined;
|
|
82
82
|
this.status = undefined;
|
|
83
83
|
this.rateLimit = undefined; // milliseconds
|
package/js/src/base/types.d.ts
CHANGED
|
@@ -180,11 +180,17 @@ export interface Balance {
|
|
|
180
180
|
total: Num;
|
|
181
181
|
debt?: Num;
|
|
182
182
|
}
|
|
183
|
-
export interface
|
|
183
|
+
export interface BalanceAccount {
|
|
184
184
|
free: Str;
|
|
185
185
|
used: Str;
|
|
186
186
|
total: Str;
|
|
187
187
|
}
|
|
188
|
+
export interface Account {
|
|
189
|
+
id: Str;
|
|
190
|
+
type: Str;
|
|
191
|
+
code: Str;
|
|
192
|
+
info: any;
|
|
193
|
+
}
|
|
188
194
|
export interface PartialBalances extends Dictionary<number> {
|
|
189
195
|
}
|
|
190
196
|
export interface Balances extends Dictionary<Balance> {
|
package/js/src/binance.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export default class binance extends Exchange {
|
|
|
20
20
|
fetchCurrencies(params?: {}): Promise<{}>;
|
|
21
21
|
fetchMarkets(params?: {}): Promise<any[]>;
|
|
22
22
|
parseMarket(market: any): Market;
|
|
23
|
-
parseBalanceHelper(entry: any): import("./base/types.js").
|
|
23
|
+
parseBalanceHelper(entry: any): import("./base/types.js").BalanceAccount;
|
|
24
24
|
parseBalanceCustom(response: any, type?: any, marginMode?: any, isPortfolioMargin?: boolean): Balances;
|
|
25
25
|
fetchBalance(params?: {}): Promise<Balances>;
|
|
26
26
|
fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
package/js/src/bitget.js
CHANGED
|
@@ -1343,10 +1343,10 @@ export default class bitget extends Exchange {
|
|
|
1343
1343
|
},
|
|
1344
1344
|
'fetchOHLCV': {
|
|
1345
1345
|
'spot': {
|
|
1346
|
-
'method': 'publicSpotGetV2SpotMarketCandles', // or publicSpotGetV2SpotMarketHistoryCandles
|
|
1346
|
+
'method': 'publicSpotGetV2SpotMarketCandles', // publicSpotGetV2SpotMarketCandles or publicSpotGetV2SpotMarketHistoryCandles
|
|
1347
1347
|
},
|
|
1348
1348
|
'swap': {
|
|
1349
|
-
'method': 'publicMixGetV2MixMarketCandles', // or publicMixGetV2MixMarketHistoryCandles or publicMixGetV2MixMarketHistoryIndexCandles or publicMixGetV2MixMarketHistoryMarkCandles
|
|
1349
|
+
'method': 'publicMixGetV2MixMarketCandles', // publicMixGetV2MixMarketCandles or publicMixGetV2MixMarketHistoryCandles or publicMixGetV2MixMarketHistoryIndexCandles or publicMixGetV2MixMarketHistoryMarkCandles
|
|
1350
1350
|
},
|
|
1351
1351
|
'maxDaysPerTimeframe': {
|
|
1352
1352
|
'1m': 30,
|
|
@@ -3316,11 +3316,13 @@ export default class bitget extends Exchange {
|
|
|
3316
3316
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
3317
3317
|
*/
|
|
3318
3318
|
await this.loadMarkets();
|
|
3319
|
-
const
|
|
3319
|
+
const defaultLimit = 100; // default 100, max 1000
|
|
3320
|
+
const maxLimitForRecentEndpoint = 1000;
|
|
3321
|
+
const maxLimitForHistoryEndpoint = 200; // note, max 1000 bars are supported for "recent-candles" endpoint, but "historical-candles" support only max 200
|
|
3320
3322
|
let paginate = false;
|
|
3321
3323
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
3322
3324
|
if (paginate) {
|
|
3323
|
-
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params,
|
|
3325
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, maxLimitForHistoryEndpoint);
|
|
3324
3326
|
}
|
|
3325
3327
|
const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
|
|
3326
3328
|
let market = undefined;
|
|
@@ -3333,32 +3335,17 @@ export default class bitget extends Exchange {
|
|
|
3333
3335
|
}
|
|
3334
3336
|
const marketType = market['spot'] ? 'spot' : 'swap';
|
|
3335
3337
|
const timeframes = this.options['timeframes'][marketType];
|
|
3336
|
-
const
|
|
3338
|
+
const msInDay = 86400000;
|
|
3337
3339
|
const duration = this.parseTimeframe(timeframe) * 1000;
|
|
3338
3340
|
const request = {
|
|
3339
3341
|
'symbol': market['id'],
|
|
3340
|
-
'granularity':
|
|
3342
|
+
'granularity': this.safeString(timeframes, timeframe, timeframe),
|
|
3341
3343
|
};
|
|
3342
|
-
const defaultLimit = 100; // by default, exchange returns 100 items
|
|
3343
|
-
const msInDay = 1000 * 60 * 60 * 24;
|
|
3344
|
-
if (limit !== undefined) {
|
|
3345
|
-
limit = Math.min(limit, maxLimit);
|
|
3346
|
-
request['limit'] = limit;
|
|
3347
|
-
}
|
|
3348
3344
|
const until = this.safeInteger2(params, 'until', 'till');
|
|
3345
|
+
const limitDefined = limit !== undefined;
|
|
3346
|
+
const sinceDefined = since !== undefined;
|
|
3347
|
+
const untilDefined = until !== undefined;
|
|
3349
3348
|
params = this.omit(params, ['until', 'till']);
|
|
3350
|
-
if (until !== undefined) {
|
|
3351
|
-
request['endTime'] = until;
|
|
3352
|
-
}
|
|
3353
|
-
if (since !== undefined) {
|
|
3354
|
-
request['startTime'] = since;
|
|
3355
|
-
if (market['spot'] && (until === undefined)) {
|
|
3356
|
-
// for spot we need to send "entTime" too
|
|
3357
|
-
const limitForEnd = (limit !== undefined) ? limit : defaultLimit;
|
|
3358
|
-
const calculatedEnd = this.sum(since, duration * limitForEnd);
|
|
3359
|
-
request['endTime'] = calculatedEnd;
|
|
3360
|
-
}
|
|
3361
|
-
}
|
|
3362
3349
|
let response = undefined;
|
|
3363
3350
|
const now = this.milliseconds();
|
|
3364
3351
|
// retrievable periods listed here:
|
|
@@ -3366,21 +3353,47 @@ export default class bitget extends Exchange {
|
|
|
3366
3353
|
// - https://www.bitget.com/api-doc/contract/market/Get-Candle-Data#description
|
|
3367
3354
|
const ohlcOptions = this.safeDict(this.options, 'fetchOHLCV', {});
|
|
3368
3355
|
const retrievableDaysMap = this.safeDict(ohlcOptions, 'maxDaysPerTimeframe', {});
|
|
3369
|
-
const
|
|
3370
|
-
const endpointTsBoundary = now -
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
if (since !== undefined && since < endpointTsBoundary) {
|
|
3375
|
-
// if since it earlier than the allowed diapason
|
|
3376
|
-
needsHistoryEndpoint = true;
|
|
3377
|
-
}
|
|
3378
|
-
else if (until !== undefined && until - displaceByLimit < endpointTsBoundary) {
|
|
3379
|
-
// if until is earlier than the allowed diapason
|
|
3380
|
-
needsHistoryEndpoint = true;
|
|
3356
|
+
const maxRetrievableDaysForRecent = this.safeInteger(retrievableDaysMap, timeframe, 30); // default to safe minimum
|
|
3357
|
+
const endpointTsBoundary = now - maxRetrievableDaysForRecent * msInDay;
|
|
3358
|
+
if (limitDefined) {
|
|
3359
|
+
limit = Math.min(limit, maxLimitForRecentEndpoint);
|
|
3360
|
+
request['limit'] = limit;
|
|
3381
3361
|
}
|
|
3362
|
+
else {
|
|
3363
|
+
limit = defaultLimit;
|
|
3364
|
+
}
|
|
3365
|
+
const limitMultipliedDuration = limit * duration;
|
|
3366
|
+
// exchange aligns from endTime, so it's important, not startTime
|
|
3367
|
+
// startTime is supported only on "recent" endpoint, not on "historical" endpoint
|
|
3368
|
+
let calculatedStartTime = undefined;
|
|
3369
|
+
let calculatedEndTime = undefined;
|
|
3370
|
+
if (sinceDefined) {
|
|
3371
|
+
calculatedStartTime = since;
|
|
3372
|
+
request['startTime'] = since;
|
|
3373
|
+
if (!untilDefined) {
|
|
3374
|
+
calculatedEndTime = this.sum(calculatedStartTime, limitMultipliedDuration);
|
|
3375
|
+
request['endTime'] = calculatedEndTime;
|
|
3376
|
+
}
|
|
3377
|
+
}
|
|
3378
|
+
if (untilDefined) {
|
|
3379
|
+
calculatedEndTime = until;
|
|
3380
|
+
request['endTime'] = calculatedEndTime;
|
|
3381
|
+
if (!sinceDefined) {
|
|
3382
|
+
calculatedStartTime = calculatedEndTime - limitMultipliedDuration;
|
|
3383
|
+
// we do not need to set "startTime" here
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
const historicalEndpointNeeded = (calculatedStartTime !== undefined) && (calculatedStartTime <= endpointTsBoundary);
|
|
3387
|
+
if (historicalEndpointNeeded) {
|
|
3388
|
+
// only for "historical-candles" - ensure we use correct max limit
|
|
3389
|
+
if (limitDefined) {
|
|
3390
|
+
request['limit'] = Math.min(limit, maxLimitForHistoryEndpoint);
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
// make request
|
|
3382
3394
|
if (market['spot']) {
|
|
3383
|
-
if
|
|
3395
|
+
// checks if we need history endpoint
|
|
3396
|
+
if (historicalEndpointNeeded) {
|
|
3384
3397
|
response = await this.publicSpotGetV2SpotMarketHistoryCandles(this.extend(request, params));
|
|
3385
3398
|
}
|
|
3386
3399
|
else {
|
|
@@ -3388,19 +3401,18 @@ export default class bitget extends Exchange {
|
|
|
3388
3401
|
}
|
|
3389
3402
|
}
|
|
3390
3403
|
else {
|
|
3391
|
-
const maxDistanceDaysForContracts = 90; // maximum 90 days allowed between start-end times
|
|
3392
|
-
|
|
3393
|
-
if (
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
throw new BadRequest(this.id + ' fetchOHLCV() between start and end must be less than ' + maxDistanceDaysForContracts.toString() + ' days');
|
|
3404
|
+
const maxDistanceDaysForContracts = 90; // for contract, maximum 90 days allowed between start-end times
|
|
3405
|
+
// only correct the request to fix 90 days if until was auto-calculated
|
|
3406
|
+
if (sinceDefined) {
|
|
3407
|
+
if (!untilDefined) {
|
|
3408
|
+
request['endTime'] = Math.min(calculatedEndTime, this.sum(since, maxDistanceDaysForContracts * msInDay));
|
|
3409
|
+
}
|
|
3410
|
+
else if (calculatedEndTime - calculatedStartTime > maxDistanceDaysForContracts * msInDay) {
|
|
3411
|
+
throw new BadRequest(this.id + ' fetchOHLCV() between start and end must be less than ' + maxDistanceDaysForContracts.toString() + ' days');
|
|
3412
|
+
}
|
|
3401
3413
|
}
|
|
3402
|
-
|
|
3403
|
-
params = this.
|
|
3414
|
+
let priceType = undefined;
|
|
3415
|
+
[priceType, params] = this.handleParamString(params, 'price');
|
|
3404
3416
|
let productType = undefined;
|
|
3405
3417
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
3406
3418
|
request['productType'] = productType;
|
|
@@ -3413,7 +3425,7 @@ export default class bitget extends Exchange {
|
|
|
3413
3425
|
response = await this.publicMixGetV2MixMarketHistoryIndexCandles(extended);
|
|
3414
3426
|
}
|
|
3415
3427
|
else {
|
|
3416
|
-
if (
|
|
3428
|
+
if (historicalEndpointNeeded) {
|
|
3417
3429
|
response = await this.publicMixGetV2MixMarketHistoryCandles(extended);
|
|
3418
3430
|
}
|
|
3419
3431
|
else {
|
package/js/src/bitmart.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export default class bitmart extends Exchange {
|
|
|
47
47
|
fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
48
48
|
fetchOrderTrades(id: string, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
49
49
|
customParseBalance(response: any, marketType: any): Balances;
|
|
50
|
-
parseBalanceHelper(entry: any): import("./base/types.js").
|
|
50
|
+
parseBalanceHelper(entry: any): import("./base/types.js").BalanceAccount;
|
|
51
51
|
fetchBalance(params?: {}): Promise<Balances>;
|
|
52
52
|
parseTradingFee(fee: any, market?: Market): {
|
|
53
53
|
info: any;
|
package/js/src/bitmart.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import Exchange from './abstract/bitmart.js';
|
|
9
|
-
import { AuthenticationError, ExchangeNotAvailable, OnMaintenance, AccountSuspended, PermissionDenied, RateLimitExceeded, InvalidNonce, InvalidAddress, ArgumentsRequired, ExchangeError, InvalidOrder, InsufficientFunds, BadRequest, OrderNotFound, BadSymbol, NotSupported } from './base/errors.js';
|
|
9
|
+
import { AuthenticationError, ExchangeNotAvailable, OnMaintenance, AccountSuspended, PermissionDenied, RateLimitExceeded, InvalidNonce, InvalidAddress, ArgumentsRequired, ExchangeError, InvalidOrder, InsufficientFunds, BadRequest, OrderNotFound, BadSymbol, NotSupported, NetworkError } from './base/errors.js';
|
|
10
10
|
import { Precise } from './base/Precise.js';
|
|
11
11
|
import { TICK_SIZE, TRUNCATE } from './base/functions/number.js';
|
|
12
12
|
import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
|
|
@@ -350,6 +350,7 @@ export default class bitmart extends Exchange {
|
|
|
350
350
|
'70000': ExchangeError,
|
|
351
351
|
'70001': BadRequest,
|
|
352
352
|
'70002': BadSymbol,
|
|
353
|
+
'70003': NetworkError,
|
|
353
354
|
'71001': BadRequest,
|
|
354
355
|
'71002': BadRequest,
|
|
355
356
|
'71003': BadRequest,
|
package/js/src/bybit.d.ts
CHANGED
|
@@ -191,7 +191,6 @@ export default class bybit extends Exchange {
|
|
|
191
191
|
};
|
|
192
192
|
fetchDerivativesMarketLeverageTiers(symbol: string, params?: {}): Promise<any[]>;
|
|
193
193
|
fetchMarketLeverageTiers(symbol: string, params?: {}): Promise<any[]>;
|
|
194
|
-
parseMarketLeverageTiers(info: any, market?: Market): any[];
|
|
195
194
|
parseTradingFee(fee: any, market?: Market): {
|
|
196
195
|
info: any;
|
|
197
196
|
symbol: string;
|
|
@@ -254,6 +253,9 @@ export default class bybit extends Exchange {
|
|
|
254
253
|
};
|
|
255
254
|
fetchMyLiquidations(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Liquidation[]>;
|
|
256
255
|
parseLiquidation(liquidation: any, market?: Market): Liquidation;
|
|
256
|
+
fetchLeverageTiers(symbols?: Strings, params?: {}): Promise<{}>;
|
|
257
|
+
parseLeverageTiers(response: any, symbols?: Strings, marketIdKey?: any): {};
|
|
258
|
+
parseMarketLeverageTiers(info: any, market?: Market): any[];
|
|
257
259
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
258
260
|
url: string;
|
|
259
261
|
method: string;
|
package/js/src/bybit.js
CHANGED
|
@@ -82,6 +82,7 @@ export default class bybit extends Exchange {
|
|
|
82
82
|
'fetchIsolatedBorrowRates': false,
|
|
83
83
|
'fetchLedger': true,
|
|
84
84
|
'fetchLeverage': true,
|
|
85
|
+
'fetchLeverageTiers': true,
|
|
85
86
|
'fetchMarketLeverageTiers': true,
|
|
86
87
|
'fetchMarkets': true,
|
|
87
88
|
'fetchMarkOHLCV': true,
|
|
@@ -7272,36 +7273,6 @@ export default class bybit extends Exchange {
|
|
|
7272
7273
|
request['symbol'] = market['id'];
|
|
7273
7274
|
return await this.fetchDerivativesMarketLeverageTiers(symbol, params);
|
|
7274
7275
|
}
|
|
7275
|
-
parseMarketLeverageTiers(info, market = undefined) {
|
|
7276
|
-
//
|
|
7277
|
-
// {
|
|
7278
|
-
// "id": 1,
|
|
7279
|
-
// "symbol": "BTCUSD",
|
|
7280
|
-
// "riskLimitValue": "150",
|
|
7281
|
-
// "maintenanceMargin": "0.5",
|
|
7282
|
-
// "initialMargin": "1",
|
|
7283
|
-
// "isLowestRisk": 1,
|
|
7284
|
-
// "maxLeverage": "100.00"
|
|
7285
|
-
// }
|
|
7286
|
-
//
|
|
7287
|
-
let minNotional = 0;
|
|
7288
|
-
const tiers = [];
|
|
7289
|
-
for (let i = 0; i < info.length; i++) {
|
|
7290
|
-
const item = info[i];
|
|
7291
|
-
const maxNotional = this.safeNumber(item, 'riskLimitValue');
|
|
7292
|
-
tiers.push({
|
|
7293
|
-
'tier': this.sum(i, 1),
|
|
7294
|
-
'currency': market['base'],
|
|
7295
|
-
'minNotional': minNotional,
|
|
7296
|
-
'maxNotional': maxNotional,
|
|
7297
|
-
'maintenanceMarginRate': this.safeNumber(item, 'maintenanceMargin'),
|
|
7298
|
-
'maxLeverage': this.safeNumber(item, 'maxLeverage'),
|
|
7299
|
-
'info': item,
|
|
7300
|
-
});
|
|
7301
|
-
minNotional = maxNotional;
|
|
7302
|
-
}
|
|
7303
|
-
return tiers;
|
|
7304
|
-
}
|
|
7305
7276
|
parseTradingFee(fee, market = undefined) {
|
|
7306
7277
|
//
|
|
7307
7278
|
// {
|
|
@@ -8006,6 +7977,95 @@ export default class bybit extends Exchange {
|
|
|
8006
7977
|
'datetime': this.iso8601(timestamp),
|
|
8007
7978
|
});
|
|
8008
7979
|
}
|
|
7980
|
+
async fetchLeverageTiers(symbols = undefined, params = {}) {
|
|
7981
|
+
/**
|
|
7982
|
+
* @method
|
|
7983
|
+
* @name bybit#fetchLeverageTiers
|
|
7984
|
+
* @see https://bybit-exchange.github.io/docs/v5/market/risk-limit
|
|
7985
|
+
* @description retrieve information on the maximum leverage, for different trade sizes
|
|
7986
|
+
* @param {string[]} [symbols] a list of unified market symbols
|
|
7987
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7988
|
+
* @param {string} [params.subType] market subType, ['linear', 'inverse'], default is 'linear'
|
|
7989
|
+
* @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
|
|
7990
|
+
*/
|
|
7991
|
+
await this.loadMarkets();
|
|
7992
|
+
let market = undefined;
|
|
7993
|
+
if (symbols !== undefined) {
|
|
7994
|
+
market = this.market(symbols[0]);
|
|
7995
|
+
if (market['spot']) {
|
|
7996
|
+
throw new NotSupported(this.id + ' fetchLeverageTiers() is not supported for spot market');
|
|
7997
|
+
}
|
|
7998
|
+
}
|
|
7999
|
+
let subType = undefined;
|
|
8000
|
+
[subType, params] = this.handleSubTypeAndParams('fetchTickers', market, params, 'linear');
|
|
8001
|
+
const request = {
|
|
8002
|
+
'category': subType,
|
|
8003
|
+
};
|
|
8004
|
+
const response = await this.publicGetV5MarketRiskLimit(this.extend(request, params));
|
|
8005
|
+
const result = this.safeDict(response, 'result', {});
|
|
8006
|
+
const data = this.safeList(result, 'list', []);
|
|
8007
|
+
symbols = this.marketSymbols(symbols);
|
|
8008
|
+
return this.parseLeverageTiers(data, symbols, 'symbol');
|
|
8009
|
+
}
|
|
8010
|
+
parseLeverageTiers(response, symbols = undefined, marketIdKey = undefined) {
|
|
8011
|
+
//
|
|
8012
|
+
// [
|
|
8013
|
+
// {
|
|
8014
|
+
// "id": 1,
|
|
8015
|
+
// "symbol": "BTCUSD",
|
|
8016
|
+
// "riskLimitValue": "150",
|
|
8017
|
+
// "maintenanceMargin": "0.5",
|
|
8018
|
+
// "initialMargin": "1",
|
|
8019
|
+
// "isLowestRisk": 1,
|
|
8020
|
+
// "maxLeverage": "100.00"
|
|
8021
|
+
// }
|
|
8022
|
+
// ]
|
|
8023
|
+
//
|
|
8024
|
+
const tiers = {};
|
|
8025
|
+
const marketIds = this.marketIds(symbols);
|
|
8026
|
+
const filteredResults = this.filterByArray(response, marketIdKey, marketIds, false);
|
|
8027
|
+
const grouped = this.groupBy(filteredResults, marketIdKey);
|
|
8028
|
+
const keys = Object.keys(grouped);
|
|
8029
|
+
for (let i = 0; i < keys.length; i++) {
|
|
8030
|
+
const marketId = keys[i];
|
|
8031
|
+
const entry = grouped[marketId];
|
|
8032
|
+
const market = this.safeMarket(marketId, undefined, undefined, 'contract');
|
|
8033
|
+
const symbol = market['symbol'];
|
|
8034
|
+
tiers[symbol] = this.parseMarketLeverageTiers(entry, market);
|
|
8035
|
+
}
|
|
8036
|
+
return tiers;
|
|
8037
|
+
}
|
|
8038
|
+
parseMarketLeverageTiers(info, market = undefined) {
|
|
8039
|
+
//
|
|
8040
|
+
// [
|
|
8041
|
+
// {
|
|
8042
|
+
// "id": 1,
|
|
8043
|
+
// "symbol": "BTCUSD",
|
|
8044
|
+
// "riskLimitValue": "150",
|
|
8045
|
+
// "maintenanceMargin": "0.5",
|
|
8046
|
+
// "initialMargin": "1",
|
|
8047
|
+
// "isLowestRisk": 1,
|
|
8048
|
+
// "maxLeverage": "100.00"
|
|
8049
|
+
// }
|
|
8050
|
+
// ]
|
|
8051
|
+
//
|
|
8052
|
+
const tiers = [];
|
|
8053
|
+
for (let i = 0; i < info.length; i++) {
|
|
8054
|
+
const tier = info[i];
|
|
8055
|
+
const marketId = this.safeString(info, 'symbol');
|
|
8056
|
+
market = this.safeMarket(marketId);
|
|
8057
|
+
tiers.push({
|
|
8058
|
+
'tier': this.safeInteger(tier, 'id'),
|
|
8059
|
+
'currency': market['settle'],
|
|
8060
|
+
'minNotional': undefined,
|
|
8061
|
+
'maxNotional': undefined,
|
|
8062
|
+
'maintenanceMarginRate': this.safeNumber(tier, 'maintenanceMargin'),
|
|
8063
|
+
'maxLeverage': this.safeNumber(tier, 'maxLeverage'),
|
|
8064
|
+
'info': tier,
|
|
8065
|
+
});
|
|
8066
|
+
}
|
|
8067
|
+
return tiers;
|
|
8068
|
+
}
|
|
8009
8069
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
8010
8070
|
let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
|
|
8011
8071
|
if (api === 'public') {
|
package/js/src/coinbase.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/coinbase.js';
|
|
2
|
-
import type { Int, OrderSide, OrderType, Order, Trade, OHLCV, Ticker, OrderBook, Str, Transaction, Balances, Tickers, Strings, Market, Currency, Num } from './base/types.js';
|
|
2
|
+
import type { Int, OrderSide, OrderType, Order, Trade, OHLCV, Ticker, OrderBook, Str, Transaction, Balances, Tickers, Strings, Market, Currency, Num, Account } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class coinbase
|
|
5
5
|
* @augments Exchange
|
|
@@ -7,9 +7,9 @@ import type { Int, OrderSide, OrderType, Order, Trade, OHLCV, Ticker, OrderBook,
|
|
|
7
7
|
export default class coinbase extends Exchange {
|
|
8
8
|
describe(): any;
|
|
9
9
|
fetchTime(params?: {}): Promise<number>;
|
|
10
|
-
fetchAccounts(params?: {}): Promise<
|
|
11
|
-
fetchAccountsV2(params?: {}): Promise<
|
|
12
|
-
fetchAccountsV3(params?: {}): Promise<
|
|
10
|
+
fetchAccounts(params?: {}): Promise<Account[]>;
|
|
11
|
+
fetchAccountsV2(params?: {}): Promise<Account[]>;
|
|
12
|
+
fetchAccountsV3(params?: {}): Promise<Account[]>;
|
|
13
13
|
parseAccount(account: any): {
|
|
14
14
|
id: string;
|
|
15
15
|
type: string;
|
|
@@ -8,7 +8,7 @@ export default class coinbaseinternational extends Exchange {
|
|
|
8
8
|
describe(): any;
|
|
9
9
|
handlePortfolioAndParams(methodName: string, params?: {}): Promise<any[]>;
|
|
10
10
|
handleNetworkIdAndParams(currencyCode: string, methodName: string, params: any): Promise<any[]>;
|
|
11
|
-
fetchAccounts(params?: {}): Promise<
|
|
11
|
+
fetchAccounts(params?: {}): Promise<import("./base/types.js").Account[]>;
|
|
12
12
|
parseAccount(account: any): {
|
|
13
13
|
id: string;
|
|
14
14
|
type: any;
|
|
@@ -118,7 +118,7 @@ export default class coinbaseinternational extends Exchange {
|
|
|
118
118
|
'test': {
|
|
119
119
|
'rest': 'https://api-n5e1.coinbase.com/api',
|
|
120
120
|
},
|
|
121
|
-
'www': 'https://
|
|
121
|
+
'www': 'https://international.coinbase.com',
|
|
122
122
|
'doc': [
|
|
123
123
|
'https://docs.cloud.coinbaseinternational.com/intx/docs',
|
|
124
124
|
],
|
package/js/src/coinbasepro.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/coinbasepro.js';
|
|
2
|
-
import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Strings, Market, Currency, Num } from './base/types.js';
|
|
2
|
+
import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Strings, Market, Currency, Num, Account } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class coinbasepro
|
|
5
5
|
* @augments Exchange
|
|
@@ -8,7 +8,7 @@ export default class coinbasepro extends Exchange {
|
|
|
8
8
|
describe(): any;
|
|
9
9
|
fetchCurrencies(params?: {}): Promise<{}>;
|
|
10
10
|
fetchMarkets(params?: {}): Promise<any[]>;
|
|
11
|
-
fetchAccounts(params?: {}): Promise<
|
|
11
|
+
fetchAccounts(params?: {}): Promise<Account[]>;
|
|
12
12
|
parseAccount(account: any): {
|
|
13
13
|
id: string;
|
|
14
14
|
type: any;
|
package/js/src/coinex.js
CHANGED
|
@@ -137,7 +137,7 @@ export default class coinex extends Exchange {
|
|
|
137
137
|
'perpetualPrivate': 'https://api.coinex.com/perpetual',
|
|
138
138
|
},
|
|
139
139
|
'www': 'https://www.coinex.com',
|
|
140
|
-
'doc': 'https://github.
|
|
140
|
+
'doc': 'https://viabtc.github.io/coinex_api_en_doc',
|
|
141
141
|
'fees': 'https://www.coinex.com/fees',
|
|
142
142
|
'referral': 'https://www.coinex.com/register?refer_code=yw5fz',
|
|
143
143
|
},
|
|
@@ -351,6 +351,7 @@ export default class coinex extends Exchange {
|
|
|
351
351
|
},
|
|
352
352
|
'broad': {
|
|
353
353
|
'ip not allow visit': PermissionDenied,
|
|
354
|
+
'service too busy': ExchangeNotAvailable,
|
|
354
355
|
},
|
|
355
356
|
},
|
|
356
357
|
});
|
|
@@ -5157,7 +5158,7 @@ export default class coinex extends Exchange {
|
|
|
5157
5158
|
* @method
|
|
5158
5159
|
* @name coinex#borrowIsolatedMargin
|
|
5159
5160
|
* @description create a loan to borrow margin
|
|
5160
|
-
* @see https://github.
|
|
5161
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account017_margin_loan
|
|
5161
5162
|
* @param {string} symbol unified market symbol, required for coinex
|
|
5162
5163
|
* @param {string} code unified currency code of the currency to borrow
|
|
5163
5164
|
* @param {float} amount the amount to borrow
|
|
@@ -5194,7 +5195,7 @@ export default class coinex extends Exchange {
|
|
|
5194
5195
|
* @method
|
|
5195
5196
|
* @name coinex#repayIsolatedMargin
|
|
5196
5197
|
* @description repay borrowed margin and interest
|
|
5197
|
-
* @see https://github.
|
|
5198
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account018_margin_flat
|
|
5198
5199
|
* @param {string} symbol unified market symbol, required for coinex
|
|
5199
5200
|
* @param {string} code unified currency code of the currency to repay
|
|
5200
5201
|
* @param {float} amount the amount to repay
|
package/js/src/coinlist.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/coinlist.js';
|
|
2
|
-
import type { Balances, Currency, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry } from './base/types.js';
|
|
2
|
+
import type { Account, Balances, Currency, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class coinlist
|
|
5
5
|
* @augments Exchange
|
|
@@ -24,7 +24,7 @@ export default class coinlist extends Exchange {
|
|
|
24
24
|
maker: any[];
|
|
25
25
|
taker: any[];
|
|
26
26
|
};
|
|
27
|
-
fetchAccounts(params?: {}): Promise<
|
|
27
|
+
fetchAccounts(params?: {}): Promise<Account[]>;
|
|
28
28
|
parseAccount(account: any): {
|
|
29
29
|
id: string;
|
|
30
30
|
type: string;
|