ccxt 4.2.72 → 4.2.74
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 +124 -122
- package/build.sh +2 -2
- package/dist/ccxt.browser.js +3277 -460
- package/dist/ccxt.browser.min.js +4 -4
- package/dist/cjs/ccxt.js +6 -1
- package/dist/cjs/src/abstract/coinbaseinternational.js +9 -0
- package/dist/cjs/src/base/Exchange.js +31 -7
- package/dist/cjs/src/bitget.js +62 -50
- package/dist/cjs/src/btcturk.js +3 -3
- package/dist/cjs/src/bybit.js +90 -30
- package/dist/cjs/src/coinbaseinternational.js +2019 -0
- package/dist/cjs/src/gate.js +1 -1
- package/dist/cjs/src/htx.js +16 -9
- package/dist/cjs/src/hyperliquid.js +9 -2
- package/dist/cjs/src/mexc.js +1 -1
- package/dist/cjs/src/okx.js +1 -1
- package/dist/cjs/src/pro/coinbaseinternational.js +645 -0
- package/dist/cjs/src/pro/krakenfutures.js +8 -7
- 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 +8 -2
- package/js/ccxt.js +6 -2
- package/js/src/abstract/coinbaseinternational.d.ts +42 -0
- package/js/src/abstract/coinbaseinternational.js +11 -0
- package/js/src/ace.d.ts +2 -2
- package/js/src/alpaca.d.ts +2 -2
- package/js/src/ascendex.d.ts +3 -3
- package/js/src/base/Exchange.d.ts +27 -24
- package/js/src/base/Exchange.js +31 -7
- package/js/src/bigone.d.ts +2 -2
- package/js/src/binance.d.ts +7 -7
- package/js/src/bingx.d.ts +4 -4
- 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 +4 -4
- package/js/src/bitflyer.d.ts +2 -2
- package/js/src/bitget.d.ts +4 -4
- package/js/src/bitget.js +62 -50
- package/js/src/bithumb.d.ts +2 -2
- package/js/src/bitmart.d.ts +4 -4
- package/js/src/bitmex.d.ts +3 -3
- package/js/src/bitopro.d.ts +2 -2
- package/js/src/bitrue.d.ts +2 -2
- package/js/src/bitso.d.ts +2 -2
- package/js/src/bitstamp.d.ts +2 -2
- package/js/src/bitteam.d.ts +2 -2
- package/js/src/bitvavo.d.ts +4 -4
- package/js/src/bl3p.d.ts +2 -2
- package/js/src/blockchaincom.d.ts +2 -2
- package/js/src/blofin.d.ts +4 -4
- package/js/src/btcalpha.d.ts +2 -2
- package/js/src/btcbox.d.ts +2 -2
- package/js/src/btcmarkets.d.ts +2 -2
- package/js/src/btcturk.d.ts +2 -2
- package/js/src/btcturk.js +3 -3
- package/js/src/bybit.d.ts +8 -6
- package/js/src/bybit.js +90 -30
- package/js/src/cex.d.ts +3 -3
- package/js/src/coinbase.d.ts +3 -3
- package/js/src/coinbaseinternational.d.ts +146 -0
- package/js/src/coinbaseinternational.js +2020 -0
- package/js/src/coinbasepro.d.ts +2 -2
- package/js/src/coincheck.d.ts +2 -2
- package/js/src/coinex.d.ts +4 -4
- package/js/src/coinlist.d.ts +3 -3
- package/js/src/coinmate.d.ts +2 -2
- package/js/src/coinmetro.d.ts +2 -2
- package/js/src/coinone.d.ts +2 -2
- package/js/src/coinsph.d.ts +2 -2
- package/js/src/coinspot.d.ts +2 -2
- package/js/src/cryptocom.d.ts +4 -4
- package/js/src/currencycom.d.ts +2 -2
- package/js/src/delta.d.ts +3 -3
- 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 +4 -4
- package/js/src/gate.js +1 -1
- package/js/src/gemini.d.ts +2 -2
- package/js/src/hitbtc.d.ts +4 -4
- package/js/src/hollaex.d.ts +2 -2
- package/js/src/htx.d.ts +5 -5
- package/js/src/htx.js +16 -9
- package/js/src/huobijp.d.ts +2 -2
- package/js/src/hyperliquid.d.ts +4 -3
- package/js/src/hyperliquid.js +10 -3
- package/js/src/idex.d.ts +2 -2
- package/js/src/independentreserve.d.ts +2 -2
- package/js/src/indodax.d.ts +2 -2
- package/js/src/kraken.d.ts +3 -3
- package/js/src/krakenfutures.d.ts +4 -4
- package/js/src/kucoin.d.ts +4 -4
- package/js/src/kucoinfutures.d.ts +3 -3
- package/js/src/kuna.d.ts +2 -2
- package/js/src/latoken.d.ts +2 -2
- 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/mexc.js +1 -1
- package/js/src/ndax.d.ts +3 -3
- package/js/src/novadax.d.ts +2 -2
- package/js/src/oceanex.d.ts +2 -2
- package/js/src/okcoin.d.ts +3 -3
- package/js/src/okx.d.ts +4 -4
- package/js/src/okx.js +1 -1
- package/js/src/onetrading.d.ts +2 -2
- package/js/src/p2b.d.ts +2 -2
- package/js/src/paymium.d.ts +2 -2
- package/js/src/phemex.d.ts +3 -3
- package/js/src/poloniex.d.ts +3 -3
- package/js/src/poloniexfutures.d.ts +2 -2
- package/js/src/pro/binance.d.ts +3 -3
- package/js/src/pro/bitvavo.d.ts +3 -3
- package/js/src/pro/cex.d.ts +3 -3
- package/js/src/pro/coinbaseinternational.d.ts +28 -0
- package/js/src/pro/coinbaseinternational.js +646 -0
- package/js/src/pro/cryptocom.d.ts +2 -2
- package/js/src/pro/hitbtc.d.ts +2 -2
- package/js/src/pro/kraken.d.ts +3 -3
- package/js/src/pro/krakenfutures.js +8 -7
- package/js/src/pro/okx.d.ts +3 -3
- package/js/src/pro/poloniex.d.ts +2 -2
- package/js/src/probit.d.ts +2 -2
- package/js/src/timex.d.ts +3 -3
- package/js/src/tokocrypto.d.ts +2 -2
- package/js/src/upbit.d.ts +2 -2
- package/js/src/wavesexchange.d.ts +2 -2
- package/js/src/wazirx.d.ts +2 -2
- package/js/src/whitebit.d.ts +2 -2
- package/js/src/woo.d.ts +5 -5
- package/js/src/yobit.d.ts +2 -2
- package/js/src/zaif.d.ts +2 -2
- package/js/src/zonda.d.ts +2 -2
- package/package.json +4 -1
- package/skip-tests.json +227 -424
package/dist/cjs/ccxt.js
CHANGED
|
@@ -51,6 +51,7 @@ var btcturk = require('./src/btcturk.js');
|
|
|
51
51
|
var bybit = require('./src/bybit.js');
|
|
52
52
|
var cex = require('./src/cex.js');
|
|
53
53
|
var coinbase = require('./src/coinbase.js');
|
|
54
|
+
var coinbaseinternational = require('./src/coinbaseinternational.js');
|
|
54
55
|
var coinbasepro = require('./src/coinbasepro.js');
|
|
55
56
|
var coincheck = require('./src/coincheck.js');
|
|
56
57
|
var coinex = require('./src/coinex.js');
|
|
@@ -136,6 +137,7 @@ var blockchaincom$1 = require('./src/pro/blockchaincom.js');
|
|
|
136
137
|
var bybit$1 = require('./src/pro/bybit.js');
|
|
137
138
|
var cex$1 = require('./src/pro/cex.js');
|
|
138
139
|
var coinbase$1 = require('./src/pro/coinbase.js');
|
|
140
|
+
var coinbaseinternational$1 = require('./src/pro/coinbaseinternational.js');
|
|
139
141
|
var coinbasepro$1 = require('./src/pro/coinbasepro.js');
|
|
140
142
|
var coincheck$1 = require('./src/pro/coincheck.js');
|
|
141
143
|
var coinex$1 = require('./src/pro/coinex.js');
|
|
@@ -178,7 +180,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
178
180
|
|
|
179
181
|
//-----------------------------------------------------------------------------
|
|
180
182
|
// this is updated by vss.js when building
|
|
181
|
-
const version = '4.2.
|
|
183
|
+
const version = '4.2.74';
|
|
182
184
|
Exchange["default"].ccxtVersion = version;
|
|
183
185
|
const exchanges = {
|
|
184
186
|
'ace': ace,
|
|
@@ -220,6 +222,7 @@ const exchanges = {
|
|
|
220
222
|
'bybit': bybit,
|
|
221
223
|
'cex': cex,
|
|
222
224
|
'coinbase': coinbase,
|
|
225
|
+
'coinbaseinternational': coinbaseinternational,
|
|
223
226
|
'coinbasepro': coinbasepro,
|
|
224
227
|
'coincheck': coincheck,
|
|
225
228
|
'coinex': coinex,
|
|
@@ -307,6 +310,7 @@ const pro = {
|
|
|
307
310
|
'bybit': bybit$1,
|
|
308
311
|
'cex': cex$1,
|
|
309
312
|
'coinbase': coinbase$1,
|
|
313
|
+
'coinbaseinternational': coinbaseinternational$1,
|
|
310
314
|
'coinbasepro': coinbasepro$1,
|
|
311
315
|
'coincheck': coincheck$1,
|
|
312
316
|
'coinex': coinex$1,
|
|
@@ -427,6 +431,7 @@ exports.btcturk = btcturk;
|
|
|
427
431
|
exports.bybit = bybit;
|
|
428
432
|
exports.cex = cex;
|
|
429
433
|
exports.coinbase = coinbase;
|
|
434
|
+
exports.coinbaseinternational = coinbaseinternational;
|
|
430
435
|
exports.coinbasepro = coinbasepro;
|
|
431
436
|
exports.coincheck = coincheck;
|
|
432
437
|
exports.coinex = coinex;
|
|
@@ -98,7 +98,7 @@ class Exchange {
|
|
|
98
98
|
this.last_request_body = undefined;
|
|
99
99
|
this.last_request_url = undefined;
|
|
100
100
|
this.last_request_path = undefined;
|
|
101
|
-
this.id =
|
|
101
|
+
this.id = 'Exchange';
|
|
102
102
|
this.markets = undefined;
|
|
103
103
|
this.status = undefined;
|
|
104
104
|
this.rateLimit = undefined; // milliseconds
|
|
@@ -1998,6 +1998,15 @@ class Exchange {
|
|
|
1998
1998
|
async fetchFundingRates(symbols = undefined, params = {}) {
|
|
1999
1999
|
throw new errors.NotSupported(this.id + ' fetchFundingRates() is not supported yet');
|
|
2000
2000
|
}
|
|
2001
|
+
async watchFundingRate(symbol, params = {}) {
|
|
2002
|
+
throw new errors.NotSupported(this.id + ' watchFundingRate() is not supported yet');
|
|
2003
|
+
}
|
|
2004
|
+
async watchFundingRates(symbols, params = {}) {
|
|
2005
|
+
throw new errors.NotSupported(this.id + ' watchFundingRates() is not supported yet');
|
|
2006
|
+
}
|
|
2007
|
+
async watchFundingRatesForSymbols(symbols, params = {}) {
|
|
2008
|
+
return await this.watchFundingRates(symbols, params);
|
|
2009
|
+
}
|
|
2001
2010
|
async transfer(code, amount, fromAccount, toAccount, params = {}) {
|
|
2002
2011
|
throw new errors.NotSupported(this.id + ' transfer() is not supported yet');
|
|
2003
2012
|
}
|
|
@@ -3248,11 +3257,19 @@ class Exchange {
|
|
|
3248
3257
|
// for example, if 'ETH' is passed for networkCode, but 'ETH' key not defined in `options->networks` object
|
|
3249
3258
|
if (networkId === undefined) {
|
|
3250
3259
|
if (currencyCode === undefined) {
|
|
3251
|
-
|
|
3252
|
-
|
|
3260
|
+
const currencies = Object.values(this.currencies);
|
|
3261
|
+
for (let i = 0; i < currencies.length; i++) {
|
|
3262
|
+
const currency = [i];
|
|
3263
|
+
const networks = this.safeDict(currency, 'networks');
|
|
3264
|
+
const network = this.safeDict(networks, networkCode);
|
|
3265
|
+
networkId = this.safeString(network, 'id');
|
|
3266
|
+
if (networkId !== undefined) {
|
|
3267
|
+
break;
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3253
3270
|
}
|
|
3254
3271
|
else {
|
|
3255
|
-
// if currencyCode was provided, then we try to find if that currencyCode has a replacement (i.e. ERC20 for ETH)
|
|
3272
|
+
// if currencyCode was provided, then we try to find if that currencyCode has a replacement (i.e. ERC20 for ETH) or is in the currency
|
|
3256
3273
|
const defaultNetworkCodeReplacements = this.safeValue(this.options, 'defaultNetworkCodeReplacements', {});
|
|
3257
3274
|
if (currencyCode in defaultNetworkCodeReplacements) {
|
|
3258
3275
|
// if there is a replacement for the passed networkCode, then we use it to find network-id in `options->networks` object
|
|
@@ -3268,11 +3285,18 @@ class Exchange {
|
|
|
3268
3285
|
}
|
|
3269
3286
|
}
|
|
3270
3287
|
}
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3288
|
+
else {
|
|
3289
|
+
// serach for network inside currency
|
|
3290
|
+
const currency = this.safeDict(this.currencies, currencyCode);
|
|
3291
|
+
const networks = this.safeDict(currency, 'networks');
|
|
3292
|
+
const network = this.safeDict(networks, networkCode);
|
|
3293
|
+
networkId = this.safeString(network, 'id');
|
|
3274
3294
|
}
|
|
3275
3295
|
}
|
|
3296
|
+
// if it wasn't found, we just set the provided value to network-id
|
|
3297
|
+
if (networkId === undefined) {
|
|
3298
|
+
networkId = networkCode;
|
|
3299
|
+
}
|
|
3276
3300
|
}
|
|
3277
3301
|
return networkId;
|
|
3278
3302
|
}
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -1340,10 +1340,10 @@ class bitget extends bitget$1 {
|
|
|
1340
1340
|
},
|
|
1341
1341
|
'fetchOHLCV': {
|
|
1342
1342
|
'spot': {
|
|
1343
|
-
'method': 'publicSpotGetV2SpotMarketCandles', // or publicSpotGetV2SpotMarketHistoryCandles
|
|
1343
|
+
'method': 'publicSpotGetV2SpotMarketCandles', // publicSpotGetV2SpotMarketCandles or publicSpotGetV2SpotMarketHistoryCandles
|
|
1344
1344
|
},
|
|
1345
1345
|
'swap': {
|
|
1346
|
-
'method': 'publicMixGetV2MixMarketCandles', // or publicMixGetV2MixMarketHistoryCandles or publicMixGetV2MixMarketHistoryIndexCandles or publicMixGetV2MixMarketHistoryMarkCandles
|
|
1346
|
+
'method': 'publicMixGetV2MixMarketCandles', // publicMixGetV2MixMarketCandles or publicMixGetV2MixMarketHistoryCandles or publicMixGetV2MixMarketHistoryIndexCandles or publicMixGetV2MixMarketHistoryMarkCandles
|
|
1347
1347
|
},
|
|
1348
1348
|
'maxDaysPerTimeframe': {
|
|
1349
1349
|
'1m': 30,
|
|
@@ -3313,11 +3313,13 @@ class bitget extends bitget$1 {
|
|
|
3313
3313
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
3314
3314
|
*/
|
|
3315
3315
|
await this.loadMarkets();
|
|
3316
|
-
const
|
|
3316
|
+
const defaultLimit = 100; // default 100, max 1000
|
|
3317
|
+
const maxLimitForRecentEndpoint = 1000;
|
|
3318
|
+
const maxLimitForHistoryEndpoint = 200; // note, max 1000 bars are supported for "recent-candles" endpoint, but "historical-candles" support only max 200
|
|
3317
3319
|
let paginate = false;
|
|
3318
3320
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
3319
3321
|
if (paginate) {
|
|
3320
|
-
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params,
|
|
3322
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, maxLimitForHistoryEndpoint);
|
|
3321
3323
|
}
|
|
3322
3324
|
const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
|
|
3323
3325
|
let market = undefined;
|
|
@@ -3330,32 +3332,17 @@ class bitget extends bitget$1 {
|
|
|
3330
3332
|
}
|
|
3331
3333
|
const marketType = market['spot'] ? 'spot' : 'swap';
|
|
3332
3334
|
const timeframes = this.options['timeframes'][marketType];
|
|
3333
|
-
const
|
|
3335
|
+
const msInDay = 86400000;
|
|
3334
3336
|
const duration = this.parseTimeframe(timeframe) * 1000;
|
|
3335
3337
|
const request = {
|
|
3336
3338
|
'symbol': market['id'],
|
|
3337
|
-
'granularity':
|
|
3339
|
+
'granularity': this.safeString(timeframes, timeframe, timeframe),
|
|
3338
3340
|
};
|
|
3339
|
-
const defaultLimit = 100; // by default, exchange returns 100 items
|
|
3340
|
-
const msInDay = 1000 * 60 * 60 * 24;
|
|
3341
|
-
if (limit !== undefined) {
|
|
3342
|
-
limit = Math.min(limit, maxLimit);
|
|
3343
|
-
request['limit'] = limit;
|
|
3344
|
-
}
|
|
3345
3341
|
const until = this.safeInteger2(params, 'until', 'till');
|
|
3342
|
+
const limitDefined = limit !== undefined;
|
|
3343
|
+
const sinceDefined = since !== undefined;
|
|
3344
|
+
const untilDefined = until !== undefined;
|
|
3346
3345
|
params = this.omit(params, ['until', 'till']);
|
|
3347
|
-
if (until !== undefined) {
|
|
3348
|
-
request['endTime'] = until;
|
|
3349
|
-
}
|
|
3350
|
-
if (since !== undefined) {
|
|
3351
|
-
request['startTime'] = since;
|
|
3352
|
-
if (market['spot'] && (until === undefined)) {
|
|
3353
|
-
// for spot we need to send "entTime" too
|
|
3354
|
-
const limitForEnd = (limit !== undefined) ? limit : defaultLimit;
|
|
3355
|
-
const calculatedEnd = this.sum(since, duration * limitForEnd);
|
|
3356
|
-
request['endTime'] = calculatedEnd;
|
|
3357
|
-
}
|
|
3358
|
-
}
|
|
3359
3346
|
let response = undefined;
|
|
3360
3347
|
const now = this.milliseconds();
|
|
3361
3348
|
// retrievable periods listed here:
|
|
@@ -3363,21 +3350,47 @@ class bitget extends bitget$1 {
|
|
|
3363
3350
|
// - https://www.bitget.com/api-doc/contract/market/Get-Candle-Data#description
|
|
3364
3351
|
const ohlcOptions = this.safeDict(this.options, 'fetchOHLCV', {});
|
|
3365
3352
|
const retrievableDaysMap = this.safeDict(ohlcOptions, 'maxDaysPerTimeframe', {});
|
|
3366
|
-
const
|
|
3367
|
-
const endpointTsBoundary = now -
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
if (since !== undefined && since < endpointTsBoundary) {
|
|
3372
|
-
// if since it earlier than the allowed diapason
|
|
3373
|
-
needsHistoryEndpoint = true;
|
|
3374
|
-
}
|
|
3375
|
-
else if (until !== undefined && until - displaceByLimit < endpointTsBoundary) {
|
|
3376
|
-
// if until is earlier than the allowed diapason
|
|
3377
|
-
needsHistoryEndpoint = true;
|
|
3353
|
+
const maxRetrievableDaysForRecent = this.safeInteger(retrievableDaysMap, timeframe, 30); // default to safe minimum
|
|
3354
|
+
const endpointTsBoundary = now - maxRetrievableDaysForRecent * msInDay;
|
|
3355
|
+
if (limitDefined) {
|
|
3356
|
+
limit = Math.min(limit, maxLimitForRecentEndpoint);
|
|
3357
|
+
request['limit'] = limit;
|
|
3378
3358
|
}
|
|
3359
|
+
else {
|
|
3360
|
+
limit = defaultLimit;
|
|
3361
|
+
}
|
|
3362
|
+
const limitMultipliedDuration = limit * duration;
|
|
3363
|
+
// exchange aligns from endTime, so it's important, not startTime
|
|
3364
|
+
// startTime is supported only on "recent" endpoint, not on "historical" endpoint
|
|
3365
|
+
let calculatedStartTime = undefined;
|
|
3366
|
+
let calculatedEndTime = undefined;
|
|
3367
|
+
if (sinceDefined) {
|
|
3368
|
+
calculatedStartTime = since;
|
|
3369
|
+
request['startTime'] = since;
|
|
3370
|
+
if (!untilDefined) {
|
|
3371
|
+
calculatedEndTime = this.sum(calculatedStartTime, limitMultipliedDuration);
|
|
3372
|
+
request['endTime'] = calculatedEndTime;
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
if (untilDefined) {
|
|
3376
|
+
calculatedEndTime = until;
|
|
3377
|
+
request['endTime'] = calculatedEndTime;
|
|
3378
|
+
if (!sinceDefined) {
|
|
3379
|
+
calculatedStartTime = calculatedEndTime - limitMultipliedDuration;
|
|
3380
|
+
// we do not need to set "startTime" here
|
|
3381
|
+
}
|
|
3382
|
+
}
|
|
3383
|
+
const historicalEndpointNeeded = (calculatedStartTime !== undefined) && (calculatedStartTime <= endpointTsBoundary);
|
|
3384
|
+
if (historicalEndpointNeeded) {
|
|
3385
|
+
// only for "historical-candles" - ensure we use correct max limit
|
|
3386
|
+
if (limitDefined) {
|
|
3387
|
+
request['limit'] = Math.min(limit, maxLimitForHistoryEndpoint);
|
|
3388
|
+
}
|
|
3389
|
+
}
|
|
3390
|
+
// make request
|
|
3379
3391
|
if (market['spot']) {
|
|
3380
|
-
if
|
|
3392
|
+
// checks if we need history endpoint
|
|
3393
|
+
if (historicalEndpointNeeded) {
|
|
3381
3394
|
response = await this.publicSpotGetV2SpotMarketHistoryCandles(this.extend(request, params));
|
|
3382
3395
|
}
|
|
3383
3396
|
else {
|
|
@@ -3385,19 +3398,18 @@ class bitget extends bitget$1 {
|
|
|
3385
3398
|
}
|
|
3386
3399
|
}
|
|
3387
3400
|
else {
|
|
3388
|
-
const maxDistanceDaysForContracts = 90; // maximum 90 days allowed between start-end times
|
|
3389
|
-
|
|
3390
|
-
if (
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
throw new errors.BadRequest(this.id + ' fetchOHLCV() between start and end must be less than ' + maxDistanceDaysForContracts.toString() + ' days');
|
|
3401
|
+
const maxDistanceDaysForContracts = 90; // for contract, maximum 90 days allowed between start-end times
|
|
3402
|
+
// only correct the request to fix 90 days if until was auto-calculated
|
|
3403
|
+
if (sinceDefined) {
|
|
3404
|
+
if (!untilDefined) {
|
|
3405
|
+
request['endTime'] = Math.min(calculatedEndTime, this.sum(since, maxDistanceDaysForContracts * msInDay));
|
|
3406
|
+
}
|
|
3407
|
+
else if (calculatedEndTime - calculatedStartTime > maxDistanceDaysForContracts * msInDay) {
|
|
3408
|
+
throw new errors.BadRequest(this.id + ' fetchOHLCV() between start and end must be less than ' + maxDistanceDaysForContracts.toString() + ' days');
|
|
3409
|
+
}
|
|
3398
3410
|
}
|
|
3399
|
-
|
|
3400
|
-
params = this.
|
|
3411
|
+
let priceType = undefined;
|
|
3412
|
+
[priceType, params] = this.handleParamString(params, 'price');
|
|
3401
3413
|
let productType = undefined;
|
|
3402
3414
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
3403
3415
|
request['productType'] = productType;
|
|
@@ -3410,7 +3422,7 @@ class bitget extends bitget$1 {
|
|
|
3410
3422
|
response = await this.publicMixGetV2MixMarketHistoryIndexCandles(extended);
|
|
3411
3423
|
}
|
|
3412
3424
|
else {
|
|
3413
|
-
if (
|
|
3425
|
+
if (historicalEndpointNeeded) {
|
|
3414
3426
|
response = await this.publicMixGetV2MixMarketHistoryCandles(extended);
|
|
3415
3427
|
}
|
|
3416
3428
|
else {
|
package/dist/cjs/src/btcturk.js
CHANGED
|
@@ -79,9 +79,9 @@ class btcturk extends btcturk$1 {
|
|
|
79
79
|
'30m': 30,
|
|
80
80
|
'1h': 60,
|
|
81
81
|
'4h': 240,
|
|
82
|
-
'1d': '1
|
|
83
|
-
'1w': '1
|
|
84
|
-
'1y': '1
|
|
82
|
+
'1d': '1 d',
|
|
83
|
+
'1w': '1 w',
|
|
84
|
+
'1y': '1 y',
|
|
85
85
|
},
|
|
86
86
|
'urls': {
|
|
87
87
|
'logo': 'https://user-images.githubusercontent.com/51840849/87153926-efbef500-c2c0-11ea-9842-05b63612c4b9.jpg',
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -79,6 +79,7 @@ class bybit extends bybit$1 {
|
|
|
79
79
|
'fetchIsolatedBorrowRates': false,
|
|
80
80
|
'fetchLedger': true,
|
|
81
81
|
'fetchLeverage': true,
|
|
82
|
+
'fetchLeverageTiers': true,
|
|
82
83
|
'fetchMarketLeverageTiers': true,
|
|
83
84
|
'fetchMarkets': true,
|
|
84
85
|
'fetchMarkOHLCV': true,
|
|
@@ -7265,36 +7266,6 @@ class bybit extends bybit$1 {
|
|
|
7265
7266
|
market['id'];
|
|
7266
7267
|
return await this.fetchDerivativesMarketLeverageTiers(symbol, params);
|
|
7267
7268
|
}
|
|
7268
|
-
parseMarketLeverageTiers(info, market = undefined) {
|
|
7269
|
-
//
|
|
7270
|
-
// {
|
|
7271
|
-
// "id": 1,
|
|
7272
|
-
// "symbol": "BTCUSD",
|
|
7273
|
-
// "riskLimitValue": "150",
|
|
7274
|
-
// "maintenanceMargin": "0.5",
|
|
7275
|
-
// "initialMargin": "1",
|
|
7276
|
-
// "isLowestRisk": 1,
|
|
7277
|
-
// "maxLeverage": "100.00"
|
|
7278
|
-
// }
|
|
7279
|
-
//
|
|
7280
|
-
let minNotional = 0;
|
|
7281
|
-
const tiers = [];
|
|
7282
|
-
for (let i = 0; i < info.length; i++) {
|
|
7283
|
-
const item = info[i];
|
|
7284
|
-
const maxNotional = this.safeNumber(item, 'riskLimitValue');
|
|
7285
|
-
tiers.push({
|
|
7286
|
-
'tier': this.sum(i, 1),
|
|
7287
|
-
'currency': market['base'],
|
|
7288
|
-
'minNotional': minNotional,
|
|
7289
|
-
'maxNotional': maxNotional,
|
|
7290
|
-
'maintenanceMarginRate': this.safeNumber(item, 'maintenanceMargin'),
|
|
7291
|
-
'maxLeverage': this.safeNumber(item, 'maxLeverage'),
|
|
7292
|
-
'info': item,
|
|
7293
|
-
});
|
|
7294
|
-
minNotional = maxNotional;
|
|
7295
|
-
}
|
|
7296
|
-
return tiers;
|
|
7297
|
-
}
|
|
7298
7269
|
parseTradingFee(fee, market = undefined) {
|
|
7299
7270
|
//
|
|
7300
7271
|
// {
|
|
@@ -7999,6 +7970,95 @@ class bybit extends bybit$1 {
|
|
|
7999
7970
|
'datetime': this.iso8601(timestamp),
|
|
8000
7971
|
});
|
|
8001
7972
|
}
|
|
7973
|
+
async fetchLeverageTiers(symbols = undefined, params = {}) {
|
|
7974
|
+
/**
|
|
7975
|
+
* @method
|
|
7976
|
+
* @name bybit#fetchLeverageTiers
|
|
7977
|
+
* @see https://bybit-exchange.github.io/docs/v5/market/risk-limit
|
|
7978
|
+
* @description retrieve information on the maximum leverage, for different trade sizes
|
|
7979
|
+
* @param {string[]} [symbols] a list of unified market symbols
|
|
7980
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7981
|
+
* @param {string} [params.subType] market subType, ['linear', 'inverse'], default is 'linear'
|
|
7982
|
+
* @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
|
|
7983
|
+
*/
|
|
7984
|
+
await this.loadMarkets();
|
|
7985
|
+
let market = undefined;
|
|
7986
|
+
if (symbols !== undefined) {
|
|
7987
|
+
market = this.market(symbols[0]);
|
|
7988
|
+
if (market['spot']) {
|
|
7989
|
+
throw new errors.NotSupported(this.id + ' fetchLeverageTiers() is not supported for spot market');
|
|
7990
|
+
}
|
|
7991
|
+
}
|
|
7992
|
+
let subType = undefined;
|
|
7993
|
+
[subType, params] = this.handleSubTypeAndParams('fetchTickers', market, params, 'linear');
|
|
7994
|
+
const request = {
|
|
7995
|
+
'category': subType,
|
|
7996
|
+
};
|
|
7997
|
+
const response = await this.publicGetV5MarketRiskLimit(this.extend(request, params));
|
|
7998
|
+
const result = this.safeDict(response, 'result', {});
|
|
7999
|
+
const data = this.safeList(result, 'list', []);
|
|
8000
|
+
symbols = this.marketSymbols(symbols);
|
|
8001
|
+
return this.parseLeverageTiers(data, symbols, 'symbol');
|
|
8002
|
+
}
|
|
8003
|
+
parseLeverageTiers(response, symbols = undefined, marketIdKey = undefined) {
|
|
8004
|
+
//
|
|
8005
|
+
// [
|
|
8006
|
+
// {
|
|
8007
|
+
// "id": 1,
|
|
8008
|
+
// "symbol": "BTCUSD",
|
|
8009
|
+
// "riskLimitValue": "150",
|
|
8010
|
+
// "maintenanceMargin": "0.5",
|
|
8011
|
+
// "initialMargin": "1",
|
|
8012
|
+
// "isLowestRisk": 1,
|
|
8013
|
+
// "maxLeverage": "100.00"
|
|
8014
|
+
// }
|
|
8015
|
+
// ]
|
|
8016
|
+
//
|
|
8017
|
+
const tiers = {};
|
|
8018
|
+
const marketIds = this.marketIds(symbols);
|
|
8019
|
+
const filteredResults = this.filterByArray(response, marketIdKey, marketIds, false);
|
|
8020
|
+
const grouped = this.groupBy(filteredResults, marketIdKey);
|
|
8021
|
+
const keys = Object.keys(grouped);
|
|
8022
|
+
for (let i = 0; i < keys.length; i++) {
|
|
8023
|
+
const marketId = keys[i];
|
|
8024
|
+
const entry = grouped[marketId];
|
|
8025
|
+
const market = this.safeMarket(marketId, undefined, undefined, 'contract');
|
|
8026
|
+
const symbol = market['symbol'];
|
|
8027
|
+
tiers[symbol] = this.parseMarketLeverageTiers(entry, market);
|
|
8028
|
+
}
|
|
8029
|
+
return tiers;
|
|
8030
|
+
}
|
|
8031
|
+
parseMarketLeverageTiers(info, market = undefined) {
|
|
8032
|
+
//
|
|
8033
|
+
// [
|
|
8034
|
+
// {
|
|
8035
|
+
// "id": 1,
|
|
8036
|
+
// "symbol": "BTCUSD",
|
|
8037
|
+
// "riskLimitValue": "150",
|
|
8038
|
+
// "maintenanceMargin": "0.5",
|
|
8039
|
+
// "initialMargin": "1",
|
|
8040
|
+
// "isLowestRisk": 1,
|
|
8041
|
+
// "maxLeverage": "100.00"
|
|
8042
|
+
// }
|
|
8043
|
+
// ]
|
|
8044
|
+
//
|
|
8045
|
+
const tiers = [];
|
|
8046
|
+
for (let i = 0; i < info.length; i++) {
|
|
8047
|
+
const tier = info[i];
|
|
8048
|
+
const marketId = this.safeString(info, 'symbol');
|
|
8049
|
+
market = this.safeMarket(marketId);
|
|
8050
|
+
tiers.push({
|
|
8051
|
+
'tier': this.safeInteger(tier, 'id'),
|
|
8052
|
+
'currency': market['settle'],
|
|
8053
|
+
'minNotional': undefined,
|
|
8054
|
+
'maxNotional': undefined,
|
|
8055
|
+
'maintenanceMarginRate': this.safeNumber(tier, 'maintenanceMargin'),
|
|
8056
|
+
'maxLeverage': this.safeNumber(tier, 'maxLeverage'),
|
|
8057
|
+
'info': tier,
|
|
8058
|
+
});
|
|
8059
|
+
}
|
|
8060
|
+
return tiers;
|
|
8061
|
+
}
|
|
8002
8062
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
8003
8063
|
let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
|
|
8004
8064
|
if (api === 'public') {
|